我进行了一些设置活动。当我做出意图时,它发生了错误。它说 " java.lang.noclassdeffounderror:失败的分辨率:landroid/support/v7/v7/app/appcompatactivity; "
他们说" alt_logout.setposistivebutton("是",new DialogInterface.onclicklistener()"此代码是问题的。我不知道我能做什么。P> else if(preference.getKey().equals("logout")){
AlertDialog.Builder alt_logout = new AlertDialog.Builder(activity);
alt_logout.setMessage("Do You want to logout?");
alt_logout.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// Action for 'Yes' Button
Intent Logout = new Intent(SettingActivity.this, LoginActivity.class);
startActivity(Logout);
}
});
alt_logout.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// Action for 'NO' Button
dialog.cancel();
}
});
AlertDialog alert
= alt_logout.create();
// Title for Alet Dialog
alert.setTitle("Logout");
alert.show();
}
更改
AlertDialog.Builder alt_logout = new AlertDialog.Builder(activity);
to
AlertDialog.Builder alt_logout = new AlertDialog.Builder(getApplicationContext());