Hi all,
I have a 2 ArrayList as
ArrayList<String> results = new ArrayList<String>();
ArrayList<String> results1 = new ArrayList<String>();
>From database I retrieved data and display them in the form of list.
results.add( rid+":"+roomName+"?"+sid+","+switchName);
results1.add( roomName+"-"+switchName);
this.setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,results));
Firstly I have only one ArrayList (i.e results). But in the list I
don't want to show rid,sid.(i.e roomid and switchid). Therefore I had
created second arrayList (i.e results) and use it in seListAdapter as
this.setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,results1));
Now on list it only shows RoomName and SwitchName. Upto now everything
is ok.
But I had used ContextMenu on this list.I had override the
public void onCreateContextMenu(ContextMenu menu, View
v,ContextMenuInfo menuInfo)
{
//here I had given 3 options 1. Add Switch 2. RemoveSwitch 3. Back
}
public boolean onContextItemSelected(MenuItem item)
{
//But now I am getting only 2 values which are in the results1 (i.e
RoomName and SwitchName). But also I want RoomID and SwitchID. I don't
know how to get them?
I had tried using
Iterator itr = results.iterator();
while(itr.hasNext())
{
String ss = itr.next().toString();
String rID1 = ss.substring(0,ss.indexOf(":"));
rID = Integer.parseInt(rID1);
.....................
}
// But the problem is that it returns only last record. (i.e.
last rid, sid).
}
Now my problem is that how to get rid and sid.
--
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