1
設定作業をしました。そして私が意図を作るとき、それは誤りが起こった。それの言う " java.lang.NoClassDefFoundErrorが:の失敗解像度:Landroid /サポート/ V7 /アプリ/ AppCompatActivity;"Androidの設定Androidスタジオの設定エラー
と彼らは言った、 "alt_logout.setPositiveButton(" はい」、新DialogInterface.OnClickListener( )「このコードは問題である。私は私が何ができるかわからない。私を助けて...へ
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();
}
このダイアログを作成する場所にクラス定義を追加してください。 –
あなたのアクティビティがAppCompatActivityを拡張していない可能性があります。 –