So no matter what I do, neither picasso and glide can load an image File OR an image string path into an imageview.
I've tried.
here is my code:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data)
{
Uri selectedImage = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};//Array size of 1, and we put in a string
Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
user_image_path = cursor.getString(columnIndex);//here we have our image path.
cursor.close();
File tempFile2 = new File(selectedImage.getPath());
//Toast.makeText(this, "I got your image " + user_image_path, Toast.LENGTH_SHORT).show();
myImageView = (ImageView) findViewById(R.id.cameraActivity_ImageView);
//Picasso.with(TakePhotoActivity.this).load(selectedImage).fit().centerCrop().into(myImageView);
Glide.with(this).load(new File(selectedImage.getPath())).centerCrop().into(myImageView);
}
}
So I've tried:
1)Picasso.with(TakePhotoActivity.this).load(user_image_path).fit().centerCrop().into(myImageView);
2)Glide.with(this).load(user_image_path).centerCrop().into(myImageView);
3)Picasso.with(TakePhotoActivity.this).load(tempFile2).fit().centerCrop().into(myImageView);
4)Glide.with(this).load(tempFile2).centerCrop().into(myImageView);
5)Picasso.with(TakePhotoActivity.this).load(selectedImage.getPath())).fit().centerCrop().into(myImageView);
6)Glide.with(this).load(selectedImage.getPath())).centerCrop().into(myImageView);
None of them worked. If i use the:
Picasso.with(TakePhotoActivity.this).load(selectedImage).fit().centerCrop().into(myImageView);
Glide.with(this).load(selectedImage).centerCrop().into(myImageView);
These two above work with the Uri selectedImage variable, but none of the others work. So why aren't the other options working and how do I get them to work, because ideally I want to work with image path Strings.
Hope you guys can help! im totally stumped on this one.