I have an Activity ListActivity having Listview and another class CustomListAdapter extends BaseAdapter.
Code in ListActivity
customAdapter = new CustomListAdapter(list);
TripList.setAdapter(customAdapter);
In getView() of CustomListAdapter I inflate a layout. there is a button and on click of that button I am starting another activity.
I want to finish ListActivity after start of another activity. With the below code My app is crashing.
((Activity) ctx).finish();
Log is
01-05 11:06:04.319: E/AndroidRuntime(4319): FATAL EXCEPTION: main
01-05 11:06:04.319: E/AndroidRuntime(4319): Process: com.example.myapp, PID: 4319
01-05 11:06:04.319: E/AndroidRuntime(4319): java.lang.NullPointerException
01-05 11:06:04.319: E/AndroidRuntime(4319): at com.example.myapp.CustomListAdapter$1.onClick(CustomListAdapter.java:71)
Please Help me out.