Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final String CREATE_TABLE_STUDENT_LESSON = " create table STUDENTSPECIFICLESSON ( _id TEXT , _viewID INTEGER PRIMARY KEY AUTOINCREMENT , _LESSON_TITLE TEXT , _LESSON_DATE TEXT , _LESSON_PROBLEM TEXT );";
- public void onCreate(SQLiteDatabase db) {
- db.execSQL(CREATE_TABLE_STUDENT_LESSON);
- }
- public void insertLesson(String _id, String lessonTitle, String lessonDate, String lessonProblem) {
- ContentValues contentValue = new ContentValues();
- contentValue.put(SQLiteHelper._ID, _id);
- contentValue.put(SQLiteHelper.LESSON_TITLE, lessonTitle);
- contentValue.put(SQLiteHelper.LESSON_DATE, lessonDate);
- contentValue.put(SQLiteHelper.LESSON_PROBLEM, lessonProblem);
- this.getWritableDatabase().insert(SQLiteHelper.TABLE_NAME_STUDENTSPECIFICLESSON, null, contentValue);
- }
- sqLiteHelper.insertLesson(id,etLessonTitle.getText().toString(),currentDateandTime,etLessonProbStu.getText().toString());
- public String getLessonViewHolderID(String _path){
- String id = null;
- Cursor cursor = getReadableDatabase().rawQuery("Select "+SQLiteHelper._viewID+" from "+SQLiteHelper.TABLE_NAME_STUDENTSPECIFICLESSON+" Where "
- +SQLiteHelper.LESSON_TITLE +"='"+_path+"'",null);
- if (cursor != null) {
- cursor.moveToFirst();
- }
- if (cursor == null) {
- } else if (cursor.moveToFirst()) {
- do {
- id = String.valueOf(cursor.getInt(cursor.getColumnIndex(SQLiteHelper._viewID)));
- } while (cursor.moveToNext());
- cursor.close();
- } else {
- }
- return id;
- }
- public String getLessonProblem(String _id){
- String id = null;
- Cursor cursor = getReadableDatabase().rawQuery("Select _LESSON_PROBLEM from "+SQLiteHelper.TABLE_NAME_STUDENTSPECIFICLESSON+" Where "
- +SQLiteHelper._viewID +"='"+_id+"'",null);
- if (cursor != null) {
- cursor.moveToFirst();
- }
- if (cursor == null) {
- } else if (cursor.moveToFirst()) {
- do {
- id = String.valueOf(cursor.getInt(cursor.getColumnIndex("_LESSON_PROBLEM")));
- } while (cursor.moveToNext());
- cursor.close();
- } else {
- }
- return id;
- }
- String lessonProblem = helper.getLessonProblem(viewId);
Add Comment
Please, Sign In to add comment