我正在开发一个应用程序,在我的主菜单中我有 4 个按钮。问题是我的按钮之一(退出按钮),如果我点击它意图我以前的活动..请帮助我..我尝试使用完成( ) 和 system.exit(0) 但它不起作用..帮助非常感谢!
public class MainMenu extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);
Button btnaniking =(Button) findViewById(R.id.baniking);
btnaniking.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
startActivity(new Intent("myapp.animalkingdom.ANIKING") );
}
});
Button btnwhoami =(Button) findViewById(R.id.bwhoami);
btnwhoami.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
startActivity(new Intent("myapp.animalkingdom.WHOAMI") );
}
});
Button btncredits =(Button) findViewById(R.id.bcredits);
btncredits.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
startActivity(new Intent("myapp.animalkingdom.CREDITS") );
}
});
Button btnexit = (Button) findViewById(R.id.bexit);
btnexit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
finish();
System.exit(0);
}
});