Hey, thank you very much! This is what I was looking for. Just one question if I may. When you start a new Intent, what exactly do you do? For my purposes, I am not sure if the Intent must pass data from the contact that you click on and pass that to the new Activity or something like that. Sorry if I am not clear, just new to the Activity/ Intent deal. Thanks again.
On Apr 4, 7:10 pm, Justin Anderson <janderson....@gmail.com> wrote: > I'm assuming this would be a custom view created by you, right? > > 1. Create a new Activity that displays the view that you want > 2. Add the information for the new Activity in the Android Manifest file > 3. In your onListItemClick method do the following: > 1. Create a new intent with the details of your new Activity > 2. Add the needed data from your list activity to the intent via > putExtra() > 3. Call startActivity with your intent > 4. Read the extra information in the onCreate() method of your new > Activity > > Hope that helps, > Justin > > ---------------------------------------------------------------------- > There are only 10 types of people in the world... > Those who know binary and those who don't. > ---------------------------------------------------------------------- > > On Sun, Apr 4, 2010 at 3:32 PM, Timothy Passaro > <timothy.pass...@gmail.com>wrote: > > > > > Hey group, I have just recently picked up android and ran into a > > stumbling block. I have been able to set up a list view of contacts on > > a phone, but have no idea how to create a new view from the item > > clicked. Any help would be great! I have been looking for a solution > > for the day, and can't seem to find anything I can comprehend, so any > > help is great! Thanks! > > > package com.grey.gui; > > > import java.util.ArrayList; > > > import android.app.ListActivity; > > import android.content.ContentResolver; > > import android.content.Intent; > > import android.database.Cursor; > > import android.os.Bundle; > > import android.provider.ContactsContract; > > import android.view.View; > > import android.widget.ArrayAdapter; > > import android.widget.ListAdapter; > > import android.widget.ListView; > > > public class MainPage extends ListActivity { > > > private ListAdapter adapter; > > private Cursor c; > > > �...@override > > public void onCreate(Bundle icicle) { > > super.onCreate(icicle); > > ContentResolver cr = getContentResolver(); > > c = cr.query(ContactsContract.Contacts.CONTENT_URI, null, > > null, null,null); > > > ArrayList<String> names = new ArrayList<String>(); > > while(c.moveToNext()){ > > //String id = > > c.getString(c.getColumnIndex(ContactsContract.Contacts._ID)); > > String name = > > c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); > > String number = > > c.getString(c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)); > > > if(number.equals("0")) continue; > > names.add(name); > > } > > > adapter = new ArrayAdapter<String>(this, > > android.R.layout.simple_list_item_1, names); > > setListAdapter(adapter); > > getListView().setTextFilterEnabled(true); > > > } > > �...@override > > public void onListItemClick(ListView l, View v, int position, long > > id) > > { > > super.onListItemClick(l, v, position, id); > > > } > > > } > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Beginners" group. > > > NEW! Try asking and tagging your question on Stack Overflow at > >http://stackoverflow.com/questions/tagged/android > > > To unsubscribe from this group, send email to > > android-beginners+unsubscr...@googlegroups.com<android-beginners%2Bunsubscr > > i...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-beginners?hl=en > > > To unsubscribe, reply using "remove me" as the subject. -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en