Thanks Kostya.

On Nov 25, 2:48 pm, Kostya Vasilyev <[email protected]> wrote:
> Pramod,
>
> Take a look at CursorAdapter: it uses a database cursor, which you can
> use in your other methods (such as context menu handlers) to get all
> necessary values directly from the database.
>
> It also lets you use your own view layout for your list items. A
> separate TextView for each data column would look much better (IMHO).
>
> So, two birds with one stone...
>
> -- Kostya
>
> 25.11.2010 12:12, pramod.deore пишет:
>
>
>
> > is there is any way using that I can hide some part of list.
> > If suppose my list is like
>
> > 1:Hall:1:AC
> > 1:Hall:2:TV
> > 1:Hall:3:Tube
>
> > But I want to show list as
> > Hall:Ac
> > Hall:TV
> > Hall:Tube.
>
> > On Nov 25, 1:21 pm, "pramod.deore"<[email protected]>  wrote:
> >> 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.
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.com

-- 
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

Reply via email to