コード例 #1
0
ファイル: MainActivity.java プロジェクト: devvmh/easygotexter
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    // its actually the order...
    Cursor c = mDbHelper.fetchNoteFromOrder(id);

    String number = c.getString(c.getColumnIndexOrThrow(DbAdapter.KEY_NUMBER));
    String recipient = c.getString(c.getColumnIndexOrThrow(DbAdapter.KEY_RECIP));

    // send a text to EasyGo
    sendText(number, recipient);
  } // onListitemClick
コード例 #2
0
ファイル: MainActivity.java プロジェクト: devvmh/easygotexter
 @Override
 public boolean onContextItemSelected(MenuItem item) {
   AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
   Cursor c = mDbHelper.fetchNoteFromOrder(info.id);
   long rowid = c.getLong(c.getColumnIndexOrThrow(DbAdapter.KEY_ROWID));
   switch (item.getItemId()) {
     case DELETE_ID:
       info = (AdapterContextMenuInfo) item.getMenuInfo();
       mDbHelper.deleteNote(rowid);
       fillData();
       return true;
     case EDIT_ID:
       Intent i = new Intent(this, EditorActivity.class);
       i.putExtra(DbAdapter.KEY_ROWID, rowid);
       startActivityForResult(i, ACTIVITY_EDIT);
       return true;
     case TEXT_ID:
       // c declared above
       String number = c.getString(c.getColumnIndexOrThrow(DbAdapter.KEY_NUMBER));
       String recipient = c.getString(c.getColumnIndexOrThrow(DbAdapter.KEY_RECIP));
       sendText(number, recipient);
   } // switch
   return super.onContextItemSelected(item);
 } // onContextItemSelected