我有三個classActivity
創建。一個是超類和其他子類,第三個是HomeActivity。如何在Android中關閉?
代碼爲超類是:
public class MyActivity extends Activity {
Button btnHome = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public void onHomeClick(View view) {
String LOG_TAG = "Akshar";
System.out.println("Hello11111");
btnHome = (Button) view;
Log.v(LOG_TAG, "index=" + btnHome);
}
}
和我的子類的代碼是:
public class ChooseIsland extends MyActivity {
Button btn_home = null;
MyActivity ob1 = new MyActivity();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chooseiland);
addListenerOnButton();
}
private void addListenerOnButton() {
// TODO Auto-generated method stub
ob1.onHomeClick(btn_home);
}
}
現在我想回家頁面上點擊時,所以當我寫?
Intent intent = new Intent(this, HomeActivity.class);