コード例 #1
0
 private List<Note> createNoteList(Cursor c) {
   List<Note> l = new ArrayList<Note>();
   if (c.moveToFirst()) {
     do {
       int id = c.getInt(0);
       String title = c.getString(1);
       String text = c.getString(2);
       Double longitude = c.getDouble(3);
       Double latitude = c.getDouble(4);
       String imagePath = c.getString(5);
       String alarm = c.getString(6);
       String date = c.getString(7);
       NoteCategory ncat = NoteCategory.values()[c.getInt(8)];
       String address = c.getString(9);
       int requestCode = c.getInt(10);
       l.add(
           new Note(
               id,
               title,
               text,
               new Location(longitude, latitude),
               imagePath,
               alarm,
               date,
               ncat,
               address,
               requestCode));
     } while (c.moveToNext());
   }
   return l;
 }
コード例 #2
0
 /**
  * @param id Id of the row to retrieve data from
  * @return a Note object containting all data from the selected row
  */
 public Note getNote(int id) {
   Cursor c = this.findNoteById(id);
   c.moveToFirst();
   String title = c.getString(1);
   String text = c.getString(2);
   Double longitude = c.getDouble(3);
   Double latitude = c.getDouble(4);
   String imagePath = c.getString(5);
   String alarm = c.getString(6);
   String date = c.getString(7);
   NoteCategory ncat = NoteCategory.values()[c.getInt(8)];
   String address = c.getString(9);
   int requestCode = c.getInt(10);
   Note n =
       new Note(
           id,
           title,
           text,
           new Location(longitude, latitude),
           imagePath,
           alarm,
           date,
           ncat,
           address,
           requestCode);
   return n;
 }