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
<[email protected]>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
> [email protected]<android-beginners%[email protected]>
> 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
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en