Activity still shows up after calling finish() from one of the listitems view of a listview . I use a viewpager indicator to host a list of fragments . The finish() method is called with an activity object from the list view .
public View getView(int position , View changeview, ViewGroup container)
{
View row_view=changeview;
if(row_view==null)
{
row_view=layoutInflater.inflate(R.layout.rate_cards_list_item,null);
viewHolder.rechargeIconListener=new RechargeIconListener()
viewHolder.topup_recharge_icon.setOnClickListener(viewHolder.rechargeIconListener);
row_view.setTag(viewHolder);
}
}
The inner class inside the list adapter
class RechargeIconListener implements View.OnClickListener
{
@Override
public void onClick(View view) {
activity_object.setResult(Activity.RESULT_OK,intent);
activity_object.finish();
Log.w("activity_object","Activity not finished");
return;
}
}
activity_object is the object of the activity that is passed along with the list adapter's constructor . Also , the activity finishes sometimes , and sometimes not .