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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:12:09+00:00 2026-05-31T05:12:09+00:00

Definition: peopleList = new ArrayList<Map<String, String>>(); PopulatePeopleList(); mAdapter = new SimpleAdapter(this, peopleList, R.layout.row ,new

  • 0

Definition:

peopleList = new ArrayList<Map<String, String>>();
PopulatePeopleList();


mAdapter = new SimpleAdapter(this, peopleList, R.layout.row ,new String[] { "Name", "Phone"  }, new int[] { R.id.text1, R.id.text2  });

txtPhoneName.setAdapter(mAdapter);

What should the xml layout look like in order for this to work properly:

Here is mine:

  <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<TextView 
 android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" 
android:padding="10dip" ></TextView>

 <TextView 
 android:id="@+id/text2"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" 
 android:padding="10dip" >   

</TextView>
</LinearLayout>

Here is my class that populates the field:

 public void PopulatePeopleList() {

 peopleList.clear();

Cursor people = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);

while (people.moveToNext())
{
String contactName = people.getString(people.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));

String contactId = people.getString(people.getColumnIndex(ContactsContract.Contacts._ID));
String hasPhone = people.getString(people.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));

if ((Integer.parseInt(hasPhone) > 0))
{

// You know have the number so now query it like this
Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,null, null);
while (phones.moveToNext()) {

//store numbers and display a dialog letting the user select which.
String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));

   Map<String, String> mapa = new HashMap<String, String>();

 mapa.put("Name",contactName);
  mapa.put("Phone", phoneNumber);

  //Then add this map to the list.
peopleList.add(mapa);
}
phones.close();
}
}
people.close();

startManagingCursor(people);
}
  • 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-31T05:12:09+00:00Added an answer on May 31, 2026 at 5:12 am

    Like this:

      <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <TextView 
     android:id="@+id/text1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:padding="10dip" >
    <TextView 
     android:id="@+id/text2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:padding="10dip" >
    </Linearlayout
    

    In order to work you must have in your row layout TextViews with the Ids you set in the adapter.

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

Sidebar

Related Questions

typically definition of property/column looks like this: <property name=DocumentSummary column=DocumentSummary length=100 type=String> <column name=DocumentSummary
I have this type definition: data Operace = Op (Int->Int->Int) String (Int->Int->Int) deriving Show
Given this definition: [UniqueId(Ident)] public class MyClass : MyBase { public int Ident{ get;
Definition(Core.h): static int (*foolink)(int*, char*, key*, key*); Also redefined in Core.cpp. This code causing
I have a route definition like this: routes.MapRoute( Pagesize, {controller}/{action}/pagesize/{pagesize}, new { controller =
Definition of variables in use: Guid fldProId = (Guid)ffdPro.GetProperty(FieldId); string fldProValue = (string)ffdPro.GetProperty(FieldValue); FormFieldDef
I have this working definition: IDENTIFIER [a-zA-Z][a-zA-Z0-9]* I don't want to keep repeating the
;; definition of the structure book ;; author: string - the author of the
My definition XML is: <CheckedTextView android:textSize=18.0dip android:text=@string/text android:textColor=@color/white android:id=@+id/test android:layout_width=fill_parent android:layout_height=wrap_content android:checkMark=?android:attr/textCheckMark /> Everything
My definition of class is like: @Entity @Table(name = items) public class Item {

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.