问题
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==RESULT_LOAD_IMAGE && resultCode==RESULT_OK && data!=null)
{
Uri selectedImage = data.getData();
String [] filePath = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(selectedImage,
filePath, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePath[0]);
picturePath = cursor.getString(columnIndex);
cursor.close();
if(picturePath != null)
{
File f = new File(picturePath);
final ImageView imageView = (ImageView) findViewById(R.id.displayAddedPostPhoto);
Picasso.with(this).load(f).resize(600,600).centerInside().into(imageView);
}
}
}
This is not loading image in the imageview on Android L devices while on the rest this works fine.
I tried it on a motorola android L 5.1.1 device with 2560 x 1440 image is not getting loaded
If I use Uri.fromFile I get the following message in logcat
Logcat shows :
Throwing OutOfMemoryError "Failed to allocate a 18386956 byte allocation with 10384296 free bytes and 9MB until OOM"
来源:https://stackoverflow.com/questions/34149550/image-view-not-set-in-android-l-using-picasso-after-loading-from-gallery