Android: List View Selected item -1
Posted
by Josemalive
on Stack Overflow
See other posts from Stack Overflow
or by Josemalive
Published on 2010-03-12T16:01:44Z
Indexed on
2010/03/12
16:37 UTC
Read the original article
Hit count: 1230
android
|android-sdk
Hi,
Im getting a -1 value when i try to get the selected item position on my listview that is already populated.
list.setOnItemClickListener
(
new AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView adapterView, View view,int arg2, long arg3)
{
int selectedPosition = adapterView.getSelectedItemPosition();
ShowAlert(String.valueOf(selectedPosition));
}
}
);
To fill my list view i use the following code:
SimpleAdapter mSchedule = new SimpleAdapter(
this,
mylist,
R.layout.listviewtest,
new String[] {"test1", "test2", "test3"},
new int[] {R.id.TextView_websitename, R.id.TextView_keywords, R.id.TextView_backlink});
Any idea?
Thanks in advance.
Best Regards.
Jose.
© Stack Overflow or respective owner