Hi all,
I have stored data in database. Now I am displaying that
data as a list now I want the name of list item that I have selected.
How to do this? Here is my code
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();
if(extras !=null)
{
value = extras.getString("roomName");
sw = getSwitchNameArray(value);
}
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice,
sw));
final ListView listView = getListView();
listView.setItemsCanFocus(false);
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listView.setOnItemClickListener(new
ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2,
long arg3)
{
// TODO Auto-generated method stub
System.out.println ("User checked boxes");
ListView lv = getListView();
int listItemCount = lv.getChildCount();
for( int i=0;i<listItemCount;i++ )
{
System.out.println
("************************");
}
}
});
}
public String[] getSwitchNameArray(String rn)
{
// return array of string
}
How to get name of selected checkbox items?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en