java当按钮调用onClick时活动停止
所以我有一个重置按钮,它调用onclick resetbutton。点击这里是代码
public void ResetButtonClicked(View view){
SharedPreferences sharedPref= getSharedPreferences("userInfo", Context.MODE_PRIVATE);
SharedPreferences.Editor editor=sharedPref.edit();
editor.putString("phone1",sa.toString());
editor.putString("phone2",re.toString());
mActivity.stud();
Toast.makeText(this, "All Emergency Numbers have been Reset.", Toast.LENGTH_SHORT).show();
}
顺便说一句:mActivity。stud是主活动的一个函数。它以前在下面给出的创建代码中声明过
MainActivity mActivity= new MainActivity();
共 (0) 个答案