How to shut down from a ListView adapter class?

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

+8
android listview adapter
source share
3 answers
button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((Activity)context).finish(); } }); 

use this code on a button click event

+14
source share

You can use the ((Activity)context).finish(); .

0
source share

Get the context of the activity, after which you can make your_file_text.finish ().

0
source share

All Articles