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 5976405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:13:26+00:00 2026-05-22T21:13:26+00:00

In my app I have a ListView of contacts with basic information (name, phone

  • 0

In my app I have a ListView of contacts with basic information (name, phone number) as well as the contact image, very similar to the default Android contact picker. If the contact has no image, it displays the app icon in its place. However, I would like to use the default silhouette image that the contact picker uses instead. My question is how can I access this image and use it in my app? Here is the section of my code that loads the contact image:

Contact c = new Contact();

    final String[] projection = new String[] {
        Contacts.DISPLAY_NAME, // the name of the contact
        Contacts.PHOTO_ID // the ID of the column in the data table for the image
    };


    final Cursor contact = getContentResolver().query(
        Contacts.CONTENT_URI,
        projection,
        Contacts._ID + "=?", // filter entries on the basis of the contact id
        new String[] {String.valueOf(contactId)}, // the parameter which the contact id column is compared to
        null
    );

    if(contact.moveToFirst()) {
        final String name = contact.getString(
                contact.getColumnIndex(Contacts.DISPLAY_NAME));
        final String photoId = contact.getString(
                contact.getColumnIndex(Contacts.PHOTO_ID));

        // Get photo data for this contact
        if(photoId != null) {
            final Cursor photo = managedQuery(
                Data.CONTENT_URI,
                new String[] {Photo.PHOTO}, // column for the photo blob
                Data._ID + "=?", // select row by id
                new String[] {photoId}, // filter by photoId
                null
            );

            // Convert photo blob to a bitmap
            if(photo.moveToFirst()) {
                byte[] photoBlob = photo.getBlob(
                        photo.getColumnIndex(Photo.PHOTO));
                final Bitmap photoBitmap = 
                    BitmapFactory.decodeByteArray(photoBlob, 0, photoBlob.length);

                c.setPhoto(photoBitmap);
            }


        }



        c.setName(name);

Here is the code in my ContactAdapter class which associates the ImageView with the contacts photo:

ImageView photo = (ImageView) v.findViewById(R.id.contact_photo);

if(photo != null) {
            if(c.hasPhoto()) photo.setImageBitmap(c.getPhoto());
            else photo.setImageResource(R.drawable.app_icon);
        }
  • 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-05-22T21:13:26+00:00Added an answer on May 22, 2026 at 9:13 pm

    There are actually 3 different images that are used in Android. You can find them in the drawable folder of the resources that come with the emulator, or you can download them from here:

    enter image description here
    enter image description here
    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In WPF app I have a ListView : <ListView Height=100 Width=434 x:Name=lvItems ItemsSource={Binding ElementName=MainWindow,
In WPF app I have a ListView: <ListView Height=100 Width=434 Margin=0,2,0,0 x:Name=lvItems ItemsSource={Binding ElementName=MainWindow,
in my app i load the contacts in a listview. i have the listview
I have a Add Contact App which in some part, it shows the contacts
I have dynamic listview on my android client app that receive data from remote
I have an app using a ListView as a main screen. Each row displays
I have a WPF App that implements a ListView. I would like to show
If I have two activities in my app, one with listview and the other
I have a basic iPhone/iPad app which has a ; a. List view &
My app have a background image that fills the screen. I'd like to display

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.