create a notepicker dialog

This commit is contained in:
tibbi 2016-10-01 21:55:54 +02:00
parent 4102800975
commit 371ee198e0
7 changed files with 21 additions and 1 deletions

View File

@ -150,7 +150,22 @@ public class MainActivity extends SimpleActivity {
}
private void displayOpenNoteDialog() {
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getResources().getString(R.string.pick_a_note));
final int cnt = mNotes.size();
String[] notes = new String[cnt];
for (int i = 0; i < cnt; i++) {
notes[i] = mNotes.get(i).getTitle();
}
builder.setItems(notes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.show();
}
private void saveText() {

View File

@ -94,7 +94,7 @@ public class DBHelper extends SQLiteOpenHelper {
public List<Note> getNotes() {
final List<Note> notes = new ArrayList<>();
final String cols[] = {COL_ID, COL_TITLE, COL_VALUE};
final Cursor cursor = mDb.query(TABLE_NAME, cols, null, null, null, null, null);
final Cursor cursor = mDb.query(TABLE_NAME, cols, null, null, null, null, COL_TITLE);
if (cursor != null) {
if (cursor.moveToFirst()) {
do {

View File

@ -17,6 +17,7 @@
<string name="delete_note">Delete note</string>
<string name="delete_note_prompt_title">Delete note</string>
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
<string name="pick_a_note">Pick a note</string>
<!-- Settings -->
<string name="settings">Einstellungen</string>

View File

@ -17,6 +17,7 @@
<string name="delete_note">Delete note</string>
<string name="delete_note_prompt_title">Delete note</string>
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
<string name="pick_a_note">Pick a note</string>
<!-- Settings -->
<string name="settings">Impostazioni</string>

View File

@ -17,6 +17,7 @@
<string name="delete_note">Delete note</string>
<string name="delete_note_prompt_title">Delete note</string>
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
<string name="pick_a_note">Pick a note</string>
<!-- Settings -->
<string name="settings">設定</string>

View File

@ -17,6 +17,7 @@
<string name="delete_note">Delete note</string>
<string name="delete_note_prompt_title">Delete note</string>
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
<string name="pick_a_note">Pick a note</string>
<!-- Settings -->
<string name="settings">Inställningar</string>

View File

@ -17,6 +17,7 @@
<string name="delete_note">Delete note</string>
<string name="delete_note_prompt_title">Delete note</string>
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
<string name="pick_a_note">Pick a note</string>
<!-- Settings -->
<string name="settings">Settings</string>