Do you really mean that you have five different list views? Or one listview
with five items??

Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com



On Fri, Nov 19, 2010 at 11:04 AM, pramod.deore <[email protected]>wrote:

> Hi, Bibek Thanks
>
> I have a function like
>
> public void retrieveSwitchListofRoom()
>        {
>                System.out.println ("Inside retrieveSwitchListofRoom()");
>                try
>                {
>                        sampleDB =  this.openOrCreateDatabase(SAMPLE_DBNAME,
> MODE_PRIVATE,
> null);
>                        Cursor c23 = sampleDB.query(SWITCH_TABLE_NAME, new
> String[]
>                                   {"SwitchID,SwitchName"}, "RoomID = "+rID
> ,null, null,
> null, null);
>
>                int count = c23.getCount();
>                System.out.println ("Total is"+count);
>
>                if (c23 != null )
>                {
>                        if  (c23.moveToFirst())
>                        {
>                                do
>                                {
>                                        switchArrayList.add(swname);
>                                }
>
>                                while (c23.moveToNext());
>                                c23.close();
>                                sampleDB.close();
>                        }
>                }
>                this.setListAdapter(new ArrayAdapter<String>(this,
> android.R.layout.simple_list_item_1,switchArrayList));
>
>                }
>                catch (Exception e)
>                {
>                        e.printStackTrace();
>                }
>        }
>
> Now you said "Use onItemClickListener on all the different list
> views,". In my activity I had override
> protected void onListItemClick(ListView l,View v,int position,long id)
> {
>
> }
>
> But this method is also get called when I select list item from other
> list. So, is it possible to write onListItemClick () within try block
> of my above code using inner class? if yes then how? Or should I
> create new Activity and then in that override onListItemClick().
> Thanks
>
> On Nov 19, 10:02 am, Kumar Bibek <[email protected]> wrote:
> > Use onItemClickListener on all the different list views, so basically you
> > will have 5 different listeners, or one listener with a 5 switch - case
> > statements, and then act accordingly. But I wonder why do you have to use
> 5
> > different list views .
> >
> > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
> >
> > On Fri, Nov 19, 2010 at 10:28 AM, pramod.deore <[email protected]
> >wrote:
> >
> > > Hi all,
> > > I have a activity in that there are more than 5 list are there. Now
> > > when I select an item from that list then onListItemClick(ListView
> > > l,View v,int position,long id) method gets called. Now I want to
> > > identify on which list I have clicked.(Because I want to do different
> > > operation for different list item selected). How to identify that on
> > > which list user clicked?
> >
> > > --
> > > 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]<android-developers%[email protected]>
> <android-developers%[email protected]<android-developers%[email protected]>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> >
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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