2011-07-27 38 views
0

我AndroidApp包含項目在4個活動5類是正常的活動和一個活動是ExpandableListActivity,對於4周的活動正在使用的onDestroy()方法和正在使用以下代碼上調用的onDestroy()方法在我的擴展列表活動

@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(); 
    } 
    } 

現在我想申請相同的代碼expandablelistactivity類,但問題是我不使用任何佈局(的setContentView(R.layout.ans);)我使用下面的代碼

public class Mainactivity extends ExpandableListActivity { 

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    // setContentView(R.layout.layout); but am not writing this line 

    setListAdapter("adapter am calling"); 
    } 

,我的疑問是如何我可以實現onDestroy()方法作爲sa我如在這個類..

請爲您that..thanking

牛逼& [R 拉吉尼卡特中號

回答

0

完全相同的方式,你在第一個例子做提供任何代碼。

相關問題