@Override public boolean onContextItemSelected(MenuItem item) { Task actual; actual = this.tasksList.get(((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position); final int pos = tasks.this.tasksList.indexOf(actual); switch (item.getItemId()) { case R.id.taskContextMenuOpt1: Intent intentModifyTask = new Intent(this, ModifyTask.class); intentModifyTask.putExtra("taskName", actual.getTaskName()); intentModifyTask.putExtra("taskDescription", actual.getTaskDescription()); intentModifyTask.putExtra("taskDeadline", actual.getTaskDeadline()); intentModifyTask.putExtra("subjectName", this.sN); startActivity(intentModifyTask); break; case R.id.taskContextMenuOpt2: tasks.this.tasksList.remove(pos); Package p = new Package(); p.setT(actual); p.setOldSubject(this.sN); p.setOption(9); new InsertManager(this.getApplicationContext()).execute(p); tasks.this.tasksListAdapter.notifyDataSetChanged(); break; } return true; }
@Override public void onStart() { super.onStart(); Package p = new Package(); p.setOption(12); p.setActualActivity(tasks.this); p.setOldSubject(this.sN); new InsertManager(this.getApplicationContext()).execute(p); this.tasksList.clear(); this.tasksListAdapter.notifyDataSetChanged(); }