Android Concept | Techbirds
Posted on: September 4, 2017 /
Categories: Mobile Applications
Code to fire Intent to Get the image from Camera and Phone Gallery in Android :
// from camera
camera_btn.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, REQUEST_TAKE_PHOTO);
}
});
// from library
library_btn.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(); intent.setType(“image/*”); intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(intent, SELECT_PICTURE);
} });
}
496 total views, 1 views today
Share this On