public void nextInstruction(boolean isSucessful, int intented_nextId) {
    SQLiteDatabase db = app.getDB();
    db.beginTransaction();
    // deal with current Instruction
    if (current != null) {
      markCurrentInstructionState(
          db, current._id, isSucessful ? Instruction.COMPLETED : Instruction.SKIPPED);
      intented_nextId = current._id + 1;
    }
    Instruction nextInstruction = fetchNextInstruction(db, intented_nextId);
    if (nextInstruction != null) { // check has nextTask
      // check if in the same task
      if (current == null || current.task_id != nextInstruction.task_id) {
        // app.enterNewTask(current, nextInstruction);
        app.enterNewTask(nextInstruction.task_id);
      }
      boolean switchSegment = (current == null) ? false : (nextInstruction.seg_id > current.seg_id);

      current = nextInstruction;
      app.setUserInfomraiton(
          null, nextInstruction._id, nextInstruction.task_id, nextInstruction.seg_id);

      if (switchSegment) app.onChangeSegment();
      //			Log.v("mark", "nextInstruction id:" + nextInstruction);
    } else { // no more instruction
      app.enterNewTask(-1);
      // app.enterNewTask(current, null);
      current = null;
      Log.v("mark", "nextInstruction is null");
      app.onAllTaskFinished();
    }
    db.setTransactionSuccessful();
    db.endTransaction();
  }