private void checkDeleteData() { final String answer = "" + ((int) (Math.random() * 900) + 100); // 100 ~ 999 BasicInputDialog dialog = new BasicInputDialog(this); dialog.setTitle(R.string.pref_dialog_del_check_title); dialog.setMessage(super.getString(R.string.pref_dialog_del_check_msg) + answer); dialog.setListener( 0, new BasicInputDialog.InputListener() { public void onInput(int id, CharSequence input, Object extra) { if (input.toString().equals(answer)) { doDeleteData(); } else { showMsg(R.string.pref_dialog_del_check_abort); } } public void onCancelInput(int id, Object extra) {} }); dialog.show(); }
private void askImportData() { File file = new File(EXTERNAL_DIR, FILENAME); if (!file.exists()) { showMsg(super.getString(R.string.pref_dialog_import_data_missed) + file.getPath()); return; } BasicInputDialog dialog = new BasicInputDialog(this); dialog.setTitle(R.string.pref_import_ext); dialog.setMessage(super.getString(R.string.pref_dialog_import_data_msg) + file.getPath()); dialog.setListener( 0, new BasicInputDialog.InputListener() { public void onInput(int id, CharSequence input, Object extra) { onImportData(input); } public void onCancelInput(int id, Object extra) {} }); dialog.show(); }