listview with button

Put your problem here if it does not fit any of the other categories.

listview with button

Postby priya_agg » Sat Jan 29, 2011 2:36 pm

new in android...
i have listview and one two buttons on every row,
i want on clicking button1, form1 will come.
and on clicking button2, form2 .....
priya_agg
Freshman
Freshman
 
Posts: 3
Joined: Wed Jan 19, 2011 6:58 pm

Top

Re: listview with button

Postby strider2023 » Mon Feb 28, 2011 1:50 pm

Hi priya,

Instead of assigning button to every listview item you can do the following,
Code: Select all

             yourList.setOnItemClickListener(new OnItemClickListener() {
         public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
               long arg3) {
            // TODO Auto-generated method stub
                                //here arg2 is the item you have selected on the list and loadForm function loads the specific form.
                                   loadForm(arg2)
         }
        });
strider2023
Senior Developer
Senior Developer
 
Posts: 126
Joined: Tue Mar 02, 2010 6:34 am
Location: Chennai, India

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 16 guests