Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:59:01+00:00 2026-06-17T20:59:01+00:00

I am trying to show contact pictures on a home screen widget using RemoteViews.setImageViewUri()

  • 0

I am trying to show contact pictures on a home screen widget using RemoteViews.setImageViewUri() but nothing is shown.

I log the picture URI and it is correct, like content://com.android.contacts/contacts/293/photo

Here is my getViewAt method:

// Create and populate the View to display at the given index.
    public RemoteViews getViewAt(int index) {

        // Create a view to display at the required index.
        RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.item_layout);

        // Populate the view with contact name.
        rv.setTextViewText(R.id.name, items.get(index).getString("first_name"));


        //check if we have a photo set
        if (items.get(index).getString("photo_url") != null) {

            Log.i("parsed uri", String.valueOf(Uri.parse(items.get(index).getString("photo_url"))));

            rv.setImageViewUri(R.id.photo_url, Uri.parse(items.get(index).getString("photo_url")));
        }

        // Create an item-specific fill-in Intent that will populate
        // the Pending Intent template created in the App Widget Provider (GridWidgetProvider).
        Intent fillInIntent = new Intent();
        fillInIntent.putExtra(Intent.EXTRA_TEXT, items.get(index));
        rv.setOnClickFillInIntent(R.id.name, fillInIntent);
        return rv;
}

It shows the contact names fine, but no pictures…

Any idea why? Thanks

Edit: xml for ImageView:

<ImageView
    android:id="@+id/photo_url"
    android:layout_width="match_parent"
    android:layout_height="125dp"
    android:layout_above="@id/name"
    android:gravity="center"
    android:background="#FFFF0000"
/>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:59:02+00:00Added an answer on June 17, 2026 at 8:59 pm

    Figured it out by myself, here is the code:

    //check if we have a photo set
            if (items.get(index).getString("photo_url") != null) {
    
                rv.setImageViewUri(R.id.photo_url, Uri.parse(items.get(index).getString("photo_url")));
            }
    
            Uri contactUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, items.get(index).getLong("contact_id"));
            InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(context.getContentResolver(), contactUri);
    
            if (input != null) {
    
                Log.i("input", String.valueOf(input));
    
                image = BitmapFactory.decodeStream(input);
    
            } else {
                image = BitmapFactory.decodeResource(context.getResources(), R.drawable.default_dark);
            }
    
            rv.setImageViewBitmap(R.id.photo_url, image);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to show profile Contact image from SQLite on android app but it
I'm trying to show/hide items within a collection using a jQueryUI slider. The slider
I am trying to show some videos on a website using HTML5. On my
I am trying to make multiple contact picker for my application. I am using
(asp.net C# project) I am trying to show contact info in my footer, I
I'm trying to use an ajax contact form to send me emails but i'd
I have a contact form that I'm trying to show/hide div's and a class
I'm trying to allows user to insert their number using a contact picker in
I am trying to make a Preference screen that just has an about, contact,
i am trying to show contact number as well as contact names in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.