Calling on onDestroy() method in my Expandable list Activity
My AndroidApp containing 5 classes in that 4 activities are normal activities and one activity is ExpandableListActivity ,for the 4 activities am using onDestroy() method and am using below code
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
unbindDrawables(findViewById("AM using layout id"));
System.gc();
}
private void unbindDrawables(View view) {
if (view.getBackground() != null) {
view.getBackground().setCallback(null);
}
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
unbindDrawables(((ViewGroup) view).getChildAt(i));
}
((ViewGroup) view).removeAllViews();
}
}
now i want to apply same code for expandablelistactivity class but the problem is am not using any layout ( setContentView(R.layout.ans);) am using below code
public class Mainactivity extends ExpandableListActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInsta开发者_开发技巧nceState);
// setContentView(R.layout.layout); but am not writing this line
setListAdapter("adapter am calling");
}
and my doubt is how can i implement onDestroy() method as same as above in this class..
please provide any code for that..thanking you
T&R Rajinikanth M
Exactly the same way as you are doing in the first example.
精彩评论