title: Android : Make sure the Cursor is initialized correctly before accessing data from it
body: <p>I'm getting an error <strong>Make sure the Cursor is initialized correctly before accessing data from it</strong> while I retrieve some data from SQLite database table. </p>
  
  <p>This is my query </p>
  
  <pre><code>dbhelper = new MyDbHelper(getContext());
                      SQLiteDatabase db = dbhelper.getReadableDatabase();
                      Cursor cursor1 = db.rawQuery("select MAX(activityObjId) from ActivityObjectList where activityId " + "= ? ", new String[]{string_ActivityId});
  
                      if (cursor1.moveToFirst())
                      {
                          maxACtivityObjId  = cursor1.getString(cursor1.getColumnIndex("activityObjId"));
                          Log.e("MAX  ", "maxACtivityObjId = " + maxACtivityObjId);
                      }
                      cursor1.close();
                      db.close();
  </code></pre>