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.
button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((Activity)context).finish(); } });
use this code on a button click event
You can use the ((Activity)context).finish(); .
((Activity)context).finish();
Get the context of the activity, after which you can make your_file_text.finish ().