有没有办法从以下ActivityResult
方法获取图像ID?
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if(requestCode == IMAGE_CAPTURE){
if(resultCode == RESULT_OK){
try{
Bitmap b1 = MediaStore.Images.Media.getBitmap(getContentResolver(),imageUri);
System.out.println("GGEGEGGEGEGEGGEGEGEGEG" + imageUri.getPath());
// Intent i2 = new Intent(Intent.ACTION_VIEW, imageUri);
// startActivity(i2);
}
catch(FileNotFoundException e ){
System.out.println("OnActivityResult hat einen Fehler geworfen");
} catch (IOException e) {
System.out.println("ONACTIVITYRESULT hat einen Fehler geworfen");
}
}
}
}
我需要它来获取某个图像的缩略图。
编辑:我像这样捕捉图像:
private void takePic() {
ContentValues values = new ContentValues();
String TITLE = null;
values.put(MediaColumns.TITLE, TITLE);
String DESCRIPTION = null;
long id = (Long) null;
values.put(ImageColumns.DESCRIPTION, DESCRIPTION);
values.put(MediaColumns.MIME_TYPE, "image/jpeg");
values.put(MediaColumns._ID, id);
imageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
System.out.println("VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVvv" + imageUri.getPath());
startActivityForResult(intent, IMAGE_CAPTURE);
}