On Nexus and LG G3 devices (which I have tried so far) I am successfully loading an image from the device memory into an ImageView (using Picasso) like this:
mProfileImageView.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), 2);
}
});
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == getActivity().RESULT_OK) {
Picasso.with(getContext()).setLoggingEnabled(true);
if (requestCode == 2) {
Picasso.with(getContext())
.load(data.getData())
.noPlaceholder()
.centerCrop()
.fit()
.into(mProfileImageView);
}
}
}
However, from some strange reason, this does not work on Galaxy S4 and S5.
I am using Picasso 2.5.2
Can any kind soul help me?
Thanks in advance!
I *finally* figured it out!
It was a permission problem as the Samsung devices used external memory. After adding the following line to the manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
It worked!