Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to finish an activity from a ListView adapter class? [duplicate]

I have an activity with a ListView that loads data from a web service. I have a button in each list item which is loaded through custom adapter class. I am handling the button events in the adapter class. Now what I need is to finish the activity with ListView from the adapter class in the button click event.

like image 301
Sundeep Avatar asked Sep 10 '13 11:09

Sundeep


1 Answers

button.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    ((Activity)context).finish();

                }
            });

use this code on button click event

like image 56
NikhilReddy Avatar answered Sep 19 '22 09:09

NikhilReddy