public class MyListActivity extends ListActivity { @Override protected void onDestroy() { // Perform cleanup operations super.onDestroy(); } }
public class MyListActivity extends ListActivity { private MyAdapter mAdapter; @Override protected void onDestroy() { mAdapter = null; // set the adapter to null to release resources super.onDestroy(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAdapter = new MyAdapter(this); setListAdapter(mAdapter); } }This example shows how to release resources used by a custom adapter in a ListActivity by setting it to null in the onDestroy() method. Package library: android.app