Do you have a sample project i can look at in which you are using the
ListView along with contacts please?
Hope to find help...
Thanks
On Nov 15, 12:28 pm, Hans <[EMAIL PROTECTED]> wrote:
> Yes i read that we should use ListView. Why should we use ListView
> rather thanListActivity?ListActivitywas working correctly until on
> its own. How would i use ListView exactly please any example available
> that has to do with contacts?
>
> This is the code:
>
> public class ALContacts extendsListActivity
> {
> private ListAdapter mAdapter;
>
> @Override
> public void onCreate(Bundle icicle)
> {
> super.onCreate(icicle);
>
> Cursor C = getContentResolver().query(People.CONTENT_URI,
> null,
> null, null, null);
> startManagingCursor(C);
>
> String[] columns = new String[] {People.NAME};
> int[] names = new int[] {R.id.row_entry};
>
> mAdapter = new SimpleCursorAdapter(this, R.layout.contacts, C,
> columns, names);
>
> setListAdapter(mAdapter);
> }
>
> @Override
> protected void onListItemClick(ListView l, View v, int position, long
> id)
> {
> super.onListItemClick(l, v, position, id);
> Intent intent = new Intent(Intent.ACTION_CALL);
> Cursor C = (Cursor) mAdapter.getItem(position);
> long phoneId =
> C.getLong(C.getColumnIndex(People.PRIMARY_PHONE_ID));
>
> intent.setData(ContentUris.withAppendedId(
> android.provider.Contacts.Phones.CONTENT_URI, phoneId));
>
> this.startActivity(intent);
> }
>
> }
>
> Thanks
>
> On Nov 15, 9:07 am, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Yes, show us the code. Though as suggested we both should use
> > ListView.
>
> > On Nov 14, 10:46 pm, Hans <[EMAIL PROTECTED]> wrote:> Hi, I also have a
> > similar problem. I managed to have aListActivity
> > > (using contacts) work successfully on its own (as a seperate project)
> > > but as soon i tried to merge this code in the prototype i am
> > > developing i am having trouble. In my project I created a new class
> > > which extends theListActivityand from My main application whenever i
> > > create an instance of this class i do not manage to get the List i was
> > > getting before. Should i paste the code here to understand my problem
> > > better? It is a well known sample available online.
>
> > > Thanks
>
> > Ranch! -- Mar 16-20, 2009http://www.bignerdranch.com/schedule.shtml
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---