// get lesosn details
  public ArrayList<MyLesson> getLessonDetails() {

    ArrayList<MyLesson> array_mylesson = new ArrayList<MyLesson>();
    String selectQuery = null;
    // if(trigger.equals("all"))
    // {
    selectQuery = "SELECT  * FROM " + TABLE_PARENTS_DETAILS;
    // }
    // else
    // {
    // selectQuery = "SELECT  * FROM "+TABLE_PARENTS_DETAILS+" where "+PID+" = "+id;
    // }
    /*Parent temp = new Parent();

    temp.setParentId("0");
    temp.setName("Select existing parent");

    getparetd.add(temp);*/
    SQLiteDatabase db = this.getReadableDatabase();

    try {
      cursor = (SQLiteCursor) db.rawQuery(selectQuery, null);
      if (cursor.moveToFirst()) {
        do {

          MyLesson myLesson = new MyLesson();
          // StudentList studentList = new StudentList();
          myLesson.setLessonId(cursor.getString(cursor.getColumnIndex(LID)));
          myLesson.setLessonDescription(cursor.getString(cursor.getColumnIndex(Description)));
          myLesson.setStartTime((cursor.getString(cursor.getColumnIndex(Starttime))));
          myLesson.setEndTime(cursor.getString(cursor.getColumnIndex(Endtime)));
          myLesson.setLessonDate(cursor.getString(cursor.getColumnIndex(Startdate)));
          myLesson.setLessonenddate(cursor.getString(cursor.getColumnIndex(Enddate)));
          myLesson.setLesson_is_active(cursor.getString(cursor.getColumnIndex(Lesson_is_active)));

          myLesson.setDuration(cursor.getString(cursor.getColumnIndex(Duration)));
          myLesson.setLesson_tutor_id(cursor.getString(cursor.getColumnIndex(Lesson_tutor_id)));
          myLesson.setTutor_name(cursor.getString(cursor.getColumnIndex(Tutor_name)));
          array_mylesson.add(myLesson);
          // array_studentlist.set(studentList);
        } while (cursor.moveToNext());
      }

      cursor.getWindow().clear();
      cursor.close();
      // close inserting data from database
      db.close();
      // return city list
      return array_mylesson;

    } catch (Exception e) {
      e.printStackTrace();
      if (cursor != null) {
        cursor.getWindow().clear();
        cursor.close();
      }

      db.close();
      return array_mylesson;
    }
  }
  // update parent
  public void updateLessonDetail(ArrayList<MyLesson> array_lesson) {
    // TODO Auto-generated method stub
    SQLiteDatabase db = this.getWritableDatabase();
    for (int i = 0; i < array_lesson.size(); i++) {
      MyLesson lesson = array_lesson.get(i);
      // String selectQuery1 = "SELECT  * FROM "+TABLE_PARENTS_DETAILS +" where "+PID+"="+
      // ParentList.getParentId();

      try {
        ContentValues values = new ContentValues();
        values.put(LID, lesson.getLessonId());
        values.put(Description, lesson.getLessonDescription());
        values.put(Starttime, lesson.getStartTime());
        values.put(Endtime, lesson.getEndTime());
        values.put(Startdate, lesson.getStartTime());
        values.put(Enddate, lesson.getLessonenddate());
        values.put(Lesson_is_active, lesson.getIsActive());
        values.put(Duration, lesson.getDuration());
        values.put(Lesson_tutor_id, lesson.getLesson_tutor_id());
        values.put(Tutor_name, lesson.getTutor_name());

        // cursor = (SQLiteCursor) db.rawQuery(selectQuery1, null);
        // if (cursor.moveToFirst()) {
        // updating row
        //	int a=db.update(TABLE_PARENTS_DETAILS, values, PID + " = ?",
        //			new String[] { String.valueOf(ParentList.getParentId()) });
        // }else{
        db.insert(TABLE_LESSON_DETAILS, null, values);
        // }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    db.close();
  }