所以我有这个重置按钮,调用onclick ResetButtonClicked这里是代码
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();
}
BTW:mActivity.stud是来自main activity.it的函数,之前已在下面给出的创建代码中声明了
MainActivity mActivity= new MainActivity();