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

The Archive Base Latest Questions

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

I’m working on an android application thats dealing with contact. I have used the

  • 0

I’m working on an android application thats dealing with contact.

I have used the following code in android 1.6 and it works fine.

public static Uri getProfilepicture(Activity activity, String address)
{
    Uri personUri = Uri.withAppendedPath(Phones.CONTENT_FILTER_URL, address);
    Cursor phoneCursor = activity.getContentResolver().query(personUri,PHONE_PROJECTION, null, null, null);
    if (phoneCursor.moveToFirst()) 
    {
        int indexPersonId = phoneCursor.getColumnIndex(Phones.PERSON_ID);
        long personId = phoneCursor.getLong(indexPersonId);
        phoneCursor.close();

        Uri uri = ContentUris.withAppendedId(People.CONTENT_URI, personId);
        return uri;
    }
    return null;
}

and getting photo in bitmap like

Bitmap bm =  People.loadContactPhoto(activity,getProfilepicture(activity, ConNum, R.drawable.artist, null);

Can any one suggest code for android 2.1 please?

  • 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-26T00:23:00+00:00Added an answer on May 26, 2026 at 12:23 am

    Thanks Friends to trying to help me. i have solve the problem by following code.

    public static Bitmap getContactPhoto(Activity activity,int contactId) 
    {
        Bitmap photo = null;
    
        final String[] projection = new String[] {
                Contacts.PHOTO_ID                       // the id of the column in the data table for the image
        };
    
        final Cursor contact = activity.managedQuery(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,projection,Contacts._ID + "=?",new String[]{String.valueOf(contactId)},null);
    
        if(contact.moveToFirst()) 
        {
            final String photoId = contact.getString(
                    contact.getColumnIndex(Contacts.PHOTO_ID));
            if(photoId != null) 
            {
                photo = queryContactBitmap(activity,photoId);
            } 
            else 
            {
                photo = null;
            }
            contact.close();
    
        }
        contact.close();
        return photo;
    }
    
    
    private static Bitmap queryContactBitmap(Activity activity,String photoId) 
    {
        final Cursor photo = activity.managedQuery(Data.CONTENT_URI,new String[] {Photo.PHOTO},Data._ID + "=?",new String[]{photoId},null);
    
        final Bitmap photoBitmap;
        if(photo.moveToFirst()) 
        {
            byte[] photoBlob = photo.getBlob(
                    photo.getColumnIndex(Photo.PHOTO));
            photoBitmap = BitmapFactory.decodeByteArray(
                    photoBlob, 0, photoBlob.length);
        } 
        else 
        {
            photoBitmap = null;
        }
        photo.close();
        return photoBitmap;
    }
    

    in that just pass the activity object and contactId. and store it into bitmam.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

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.