Using oninto an item does not work.ListItemClick() help!

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Using oninto an item does not work.ListItemClick() help!

Postby xzrt_droid » Sun Apr 04, 2010 8:06 pm

Hey guys, I am having trouble defining what should be within my onListItemClick method. Any help would be appreciated. Currently, I have a ListView set up correctly, but going:

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);
Object o = this.getListAdapter().getItem(position);

}

}
xzrt_droid
Freshman
Freshman
 
Posts: 2
Joined: Sat Apr 03, 2010 3:52 pm
Location: Pittsburgh

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests