是否有可能开始同一个活动上按一下按钮。 我在我的MainActivity一个按钮,我想,当我点击该按钮当前活动(MainActivity)重新启动(重新开始)?在此先感谢。
Is it possible to start the same activity on button click. I have a button in my MainActivity and I want that when I click that button the current Activity (MainActivity) restarts (start again) ? Thanks in Advance.
试试这个:)
Button buttonOne = (Button) findViewById(R.id.button1);
buttonOne.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this,
MainActivity.class);
startActivity(intent);
}
});
但我不明白为什么你要做到这一点:P
But i dont understand why you wanna do this :P