title: set text in EditText from database
body: <p>I want to display content of a column of a record in a EditText . So to achieve this I made this function in my adapter to get a unqiue row cooresponding to a ID +Name pair </p>
  
  <pre><code>public Cursor queryNotes(int lectureID,String user){
      String[] columns = new String[]{KEY_ID,USERNAME,LECTURE_NAME, LECTURE_DATE,LECTURE_NOTES};
  
      Cursor cursor = sqLiteDatabase.query(MYDATABASE_TABLE,columns ,
              KEY_ID+"=? AND "+USERNAME+"=?" , new String[] { String.valueOf(lectureID),String.valueOf(user) }, null, null, null,null);
      return cursor;
  }
  </code></pre>
  
  <p>Then in my fragment class where i want to set the text i did something like this :</p>
  
  <pre><code>cursor = mySQLiteAdapter.queryNotes(position,name);
      cursor.moveToPosition(0); 
      if(cursor!=null) { 
          do { 
              String previousNotes = cursor.getString(4); 
              shortnotes.setText(previousNotes);//I assume shortnotes is the EditText I want to set
      }while(cursor.moveToNext());
  }
     cursor.close();
  </code></pre>
  
  <p>Is this the right way to set the Edit text?Please help me </p>
  
  <p>Logcat :</p>
  
  <blockquote>
    <p>11-04 17:46:27.141: E/AndroidRuntime(9154): in writeCrashedAppName, pkgName :com.example.loginphase
    11-04 17:46:27.141: D/AndroidRuntime(9154): file written successfully with content: com.example.loginphase StringBuffer : ;com.example.loginphase
    11-04 17:46:27.141: E/AndroidRuntime(9154): FATAL EXCEPTION: main
    11-04 17:46:27.141: E/AndroidRuntime(9154): Process: com.example.loginphase, PID: 9154
    11-04 17:46:27.141: E/AndroidRuntime(9154): android.database.sqlite.SQLiteException: no such column: LECTURE_NOTES (code 1): , while compiling: SELECT _id, USERNAME, LECTURE_NAME, LECTURE_DATE, LECTURE_NOTES FROM LECTURE_TABLE WHERE _id=? AND USERNAME=?
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1238)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at database.LecturesDatabaseAdapter.queryNotes(LecturesDatabaseAdapter.java:83)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at com.example.loginphase.RecordLectureFragment.onCreateView(RecordLectureFragment.java:34)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.app.Fragment.performCreateView(Fragment.java:1700)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.app.BackStackRecord.run(BackStackRecord.java:684)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.os.Handler.handleCallback(Handler.java:733)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.os.Handler.dispatchMessage(Handler.java:95)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.os.Looper.loop(Looper.java:136)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at android.app.ActivityThread.main(ActivityThread.java:5021)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at java.lang.reflect.Method.invokeNative(Native Method)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at java.lang.reflect.Method.invoke(Method.java:515)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
    11-04 17:46:27.141: E/AndroidRuntime(9154):     at dalvik.system.NativeStart.main(Native Method)</p>
  </blockquote>
  
  <p>Here is my helper class for database :</p>
  
  <pre><code> public class LectureDatabaseHelper extends SQLiteOpenHelper {
   public static final String MYDATABASE_NAME = "LECTURE_DATABASE";
   public static final String MYDATABASE_TABLE = "LECTURE_TABLE";
   public static final int MYDATABASE_VERSION = 2;
   public static final String KEY_ID = "_id";
   public static final String USERNAME = "USERNAME";
   public static final String LECTURE_NAME = "LECTURE_NAME";
   public static final String LECTURE_DATE = "LECTURE_DATE";
   public static final String LECTURE_NOTES = "LECTURE_NOTES";
   private static final String SCRIPT_CREATE_DATABASE =
            "create table " + MYDATABASE_TABLE + " ("
            + KEY_ID + " integer primary key autoincrement, "
            + USERNAME + " text not null, "
            + LECTURE_NAME + " text not null, "
            + LECTURE_DATE + " text not null, "
            + LECTURE_NOTES + " text null);";
    public LectureDatabaseHelper(Context context, String name,
      CursorFactory factory, int version) {
     super(context, name, factory, version);
    }
    public void onCreate(SQLiteDatabase db) {
     db.execSQL(SCRIPT_CREATE_DATABASE);
    }
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      db.execSQL("DROP TABLE "+MYDATABASE_TABLE+";");
      onCreate(db);
    }
   }
  </code></pre>