0
我正嘗試在用戶點擊的位置顯示相機拍攝的圖像的標記(縮略圖)的全尺寸圖像。但到目前爲止,圖像會顯示,但始終顯示拍攝的最新圖像,而不是之前拍攝第一個標記時拍攝的圖像。如何在拍攝由相機意圖拍攝的各種標記時顯示圖像?
這裏是我到目前爲止的代碼:
public void onMapLongClick(final LatLng point) {
poinOnMap=point;
googleMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri selectedImage = intent.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(
selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String fileUri = cursor.getString(columnIndex);
cursor.close();
bitmap = BitmapFactory.decodeFile(fileUri);
Uri imgUri = Uri.parse("file://" + bitmap + fileUri);
intent.setDataAndType(imgUri, "image/*");
startActivity(intent);
return;
}
});
getApplicationContext().getDir(
getResources().getString(R.string.app_name), MODE_PRIVATE);
fileUri = Uri.fromFile(new File((Environment.getExternalStorageDirectory() +
"/" +getResources().getString(R.string.app_name)),new Date().getTime() + ".jpg"));
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
startActivityForResult(takePictureIntent,TAKE_PICTURE);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == TAKE_PICTURE && resultCode == RESULT_OK) {
try {
GetImageThumbnail getImageThumbnail = new GetImageThumbnail();
bitmap = getImageThumbnail.getThumbnail(fileUri, this);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
誰能告訴我什麼,我做錯了什麼?