Esempio n. 1
0
 public void deleteThis(View v) {
   datashop.open();
   long[] ids = new long[1];
   ids[0] = id;
   datashop.deleteMultipleTasks(ids);
   datashop.deleteNotify(ids);
   datashop.deleteTaskDays(ids);
   datashop.close();
   super.finish();
 }
Esempio n. 2
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        // This ID represents the Home or Up button. In the case of this
        // activity, the Up button is shown. Use NavUtils to allow users
        // to navigate up one level in the application structure. For
        // more details, see the Navigation pattern on Android Design:
        //
        // http://developer.android.com/design/patterns/navigation.html#up-vs-back
        //
        NavUtils.navigateUpFromSameTask(this);
        return true;

      case R.id.menu_edit:
        Intent data = new Intent();
        data.putExtra("id", id);
        data.putExtra("name", ((TextView) findViewById(R.id.add_task_name)).getText().toString());
        data.putExtra("alarm-hour", hour);
        data.putExtra("alarm-minute", minute);
        data.putExtra("days", selectedItems);
        data.putExtra("mss", mss);
        setResult(RESULT_OK, data);
        super.finish();

      case R.id.menu_delete:
        datashop.open();
        long[] ids = new long[1];
        ids[0] = id;
        datashop.deleteMultipleTasks(ids);
        datashop.deleteNotify(ids);
        datashop.deleteTaskDays(ids);
        datashop.close();
        super.finish();
    }
    return super.onOptionsItemSelected(item);
  }