8
Android 2.3.3
I have looked at various examples on how to get "Photo of a Contact". But none of them worked for me. Surprisingly, I have stumbled upon a code at StackOVerFlow and I used it and could get the "Photo" and display it in ImageView in my ListView.
Scenario of my application :::
I have to get data from Phone (Image / Photo, Contact Name, Phone Number) and display them in a ListView (with CustomView as each Item)
XML File with ListView :::
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/txtViewContactsHeader"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:text="Your Contacts (Phone + SIM)"
android:layout_gravity="center"
android:gravity="center" />
<ListView
android:id="@+id/lv_addcontact"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="center" >
<Button
android:id="@+id/btn_addcontact_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ADD CONTACTS" />
<Button
android:id="@+id/btn_addcontact_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CANCEL" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical" >
<TextView
android:id="@+id/txtViewNavigation"