Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void onActivityResult(int requestCode, int resultCode,Intent data) {
- if (resultCode == RESULT_OK) {
- Uri targetUri = data.getData();
- Bitmap bitmap = null;
- bitmap = BitmapFactory.decodeFile(getRealPathFromURI(targetUri));
- //bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(targetUri));
- addMarker(bitmap);
- }
- }
- public String getRealPathFromURI(Uri contentUri) {
- // can post image
- String [] proj={MediaStore.Images.Media.DATA};
- Cursor cursor = managedQuery( contentUri,
- proj, // Which columns to return
- null, // WHERE clause; which rows to return (all rows)
- null, // WHERE clause selection arguments (none)
- null); // Order-by clause (ascending by name)
- int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
- cursor.moveToFirst();
- return cursor.getString(column_index);
- }
- 09-29 21:28:35.960: E/AndroidRuntime(4746):
- java.lang.RuntimeException: Failure delivering result ResultInfo
- {who=null, request=1, result=-1, data=Intent
- { dat=content://media/external/images/media/3 }} to activity
- {com.sit.augmented_reality/com.sit.augmented_reality.activity.Demo}:
- java.lang.NullPointerException
Add Comment
Please, Sign In to add comment