1: @Override
2: public void onActivityResult(int requestCode, int resultCode,
3: Intent data) {
4: Log.i(TAG, "request code:"+resultCode);
5: super.onActivityResult(requestCode, resultCode, data);
6: Uri selectedImage = null;
7: switch(requestCode) {
8: case 1234:
9: if(resultCode == RESULT_OK){
10: selectedImage = data.getData();
11: Log.i(TAG, "Uri:"+selectedImage);
12:
13: /* Now you have choosen image in Bitmap format in object "yourSelectedImage". You can use it in way you want! */
14: }
15: case 10:
16: if(resultCode == RESULT_OK){
17: selectedImage = data.getData();
18: Log.i(TAG, "Uri:"+selectedImage);
19: }
20: break;
21: }
22:
23: String[] filePathColumn = {MediaStore.Images.Media.DATA};
24:
25: Cursor cursor = this.getActivity().getContentResolver().query(selectedImage, filePathColumn, null, null, null);
26: cursor.moveToFirst();
27:
28: int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
29: String filePath = cursor.getString(columnIndex);
30: cursor.close();
31:
32:
33: Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath);
34:
35: this.imageView.setImageBitmap(yourSelectedImage);
36: }