I am taking a picture with the built-in camera intent, and my app just needs the image to create one bitmap. Is it possible to avoid the image saving to the gallery without creating my own custom camera? Here is my current code to take the picture.
public void open() {
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 1);
}
static Bitmap bp;
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
bp = (Bitmap) data.getExtras().get("data");
onNavigationDrawerItemSelected(currentPosition);
}
Nop, but you can delete it, try this code:
private void DeletePicTaken(){
final String[] imageColumns = { BaseColumns._ID, MediaColumns.DATA };
final String imageOrderBy = BaseColumns._ID + " DESC";
Cursor imageCursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, imageColumns, null, null, imageOrderBy);
if(imageCursor.moveToFirst()){
//int id = imageCursor.getInt(imageCursor.getColumnIndex(MediaStore.Images.Media._ID));
String fullPath = imageCursor.getString(imageCursor.getColumnIndex(MediaColumns.DATA));
//imageCursor.close();
File file = new File(fullPath);
file.delete();
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
bp = (Bitmap) data.getExtras().get("data");
onNavigationDrawerItemSelected(currentPosition);
DeletePicTaken();
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments