我在取由照相機捕捉到另一個活動的圖像視圖,請找出問題的圖像得到一個問題的ImageView .....捕獲從相機和負荷圖像的圖像到另一個活動
public void onClick(View v) {
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
和onActivityresult()是
protected void onActivityResult(int requestCode, int resultCode, Intent data,Uri mCapturedImageURI)
{
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==CAMERA_REQUEST&&resultCode==RESULT_OK)
{
String[] projection = { MediaStore.Images.Media.DATA};
Cursor cursor = managedQuery(mCapturedImageURI, projection, null, null, null);
int column_index_data = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String picturepath = cursor.getString(column_index_data);
Log.d("TAG", "getLastImageId::path " + picturepath);
Intent camintent= new Intent(MainActivity.this,GalleryActivity.class);
camintent.putExtra("imagePath",picturepath);
startActivity(camintent);
}
}
和我的另一個(接收)活性是........
private void getData(){
String ps=getIntent().getStringExtra("imagePath");
img.setImageBitmap(BitmapFactory.decodeFile(ps));
}
「_I時,出現了問題..._」而且那會是什麼問題? – csmckelvey
無法在其他活動中檢索圖像...... – amanjain4all
Log.d(「TAG」,「getLastImageId :: path」+圖片路徑);這個日誌的操作是什麼。如果它的內容uri,那麼首先你需要將它轉換爲文件路徑。 – Manmohan