Run the app in debug mode and set a breakpoint on if (requestCode == SELECT_PICTURE)
and inspect each variable as you step through to ensure it is being set as expected. If you are getting a NPE on img.setImageURI(selectedImageUri);
then either img
or selectedImageUri
are not set.