我该怎么做?
点击按钮:
mycontext.finish();
然后:再次开始?
答案 0 :(得分:3)
你可以试试这个:
MyActivity.finish()
Intent intent = new Intent(MyActivity.this, MyActivity.class);
startActivity(intent);
如果这不起作用,你可以这样做:
private boolean isRestarting = false;
...
// When button is pressed
isRestarting = true;
myactivity.finish();
...
// in the onDestroy() method
if(isFinishing() && isRestarting){
Intent intent = new Intent(MyActivity.this, MyActivity.class);
startActivity(intent);
}