Dev01
Dev01

Reputation: 4222

android can't get photo uri from db cursor

I am storing contact photos in db but when I want to load those photos to imageview, i am getting error:

The method setImageURI(Uri) in the type ImageView is not applicable
for the arguments (String)

Here is the call to setImageURI inside a class that extends CursorAdapter in order to show contact photos in listview:

photoView.setImageURI(cursor.getString(3));

I also tried type caste string to uri but that isn't allowed either:

photoView.setImageURI((Uri) cursor.getString(3));

How do I load photo from cursor into imageview ? Thanks

Upvotes: 0

Views: 353

Answers (1)

Junaid
Junaid

Reputation: 7860

Here:

    String mUri = cursor.getString(3)
    Uri myUri = Uri.parse(mUri);
    photoView.setImageURI((myUri) 

Upvotes: 2

Related Questions