W wewnetrznej klasie rozszerzajacej DialogInterface.onClickListener chce przechwycic wyjatek z tematu:
class DialogListener implements DialogInterface.OnClickListener {
View view;
public DialogListener(View view) {
this.view = view;
}
@Override
public void onClick(DialogInterface dialog, int buttonID) {
if (buttonID == DialogInterface.BUTTON_POSITIVE) {
try {
db.insertListNameIntoListsNames("Lista1");
} catch (Exception ex) {
}
}
}
}
a o to moja metoda insert umieszczona w innej klasie DB extends SQLiteHelper
//Metoda umieszcza nazwe listy w listsnames
public void insertListNameIntoListsNames(String listname) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("listname", listname);
db.insert("listsname",null,contentValues);
db.close();
}
Dodam ze kolumna listname jest typu text not null unique co powoduje ten wyjatek.Natomiast moj blok try-catch go nie przechwytuje i aplikacja sie wykracza.
Z gory dzieki za wszelkie sugestie