title: How get the return string from mainclass
body: <p>DbHelper.java</p>
  
  <pre><code>public static String returntitle(Context context , String query) {
      DbHelper dbhelper = new DbHelper(context);
      SQLiteDatabase db = dbhelper.getReadableDatabase();
      // Cursor cursor = null;
      String temp_title = null;
      Cursor cursor = db.rawQuery(query, null);
      if (cursor.moveToFirst()) {
          do {
              temp_title = (cursor.getString(1));
          } while (cursor.moveToNext());
      }
  
      return temp_title;
  }
  </code></pre>
  
  <p>How to get the temp_title in mainclass.java</p>
  
  <p>mainClass.java</p>
  
  <pre><code>private void gettitleform_db() {
      // TODO Auto-generated method stub
      String str = "SELECT cl_title_tb_resume FROM tb_resume WHERE _id = 2 ";
      String temp2 = DbHelper.returntitle(this, str);
      System.out.println(temp2);
  }
  </code></pre>
  
  <p>the above code returns an exception. whats wrong with my code. Thanks in advance</p>
  
  <p>Logcat</p>
  
  <pre><code>11-25 13:08:52.330: W/ApplicationPackageManager(17274): getCSCPackageItemText()
  11-25 13:08:52.390: D/mali_winsys(17274): new_window_surface returns 0x3000
  11-25 13:08:58.145: W/ApplicationPackageManager(17274): getCSCPackageItemText()
  11-25 13:08:58.160: D/AbsListView(17274): Get MotionRecognitionManager
  11-25 13:08:58.175: E/CursorWindow(17274): Failed to read row 0, column 1 from a CursorWindow which has 1 rows, 1 columns.
  11-25 13:08:58.175: D/AndroidRuntime(17274): Shutting down VM
  11-25 13:08:58.175: W/dalvikvm(17274): threadid=1: thread exiting with uncaught exception (group=0x41770c08)
  11-25 13:08:58.175: E/AndroidRuntime(17274): FATAL EXCEPTION: main
  11-25 13:08:58.175: E/AndroidRuntime(17274): Process: com.absind.resumebuilder, PID: 17274
  11-25 13:08:58.175: E/AndroidRuntime(17274): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.absind.resumebuilder/com.absind.resumebuilder.AddList}: java.lang.IllegalStateException: Couldn't read row 0, col 1 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2282)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2340)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.app.ActivityThread.access$800(ActivityThread.java:157)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.os.Handler.dispatchMessage(Handler.java:102)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.os.Looper.loop(Looper.java:157)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.app.ActivityThread.main(ActivityThread.java:5293)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at java.lang.reflect.Method.invokeNative(Native Method)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at java.lang.reflect.Method.invoke(Method.java:515)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1259)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at dalvik.system.NativeStart.main(Native Method)
  11-25 13:08:58.175: E/AndroidRuntime(17274): Caused by: java.lang.IllegalStateException: Couldn't read row 0, col 1 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.database.CursorWindow.nativeGetString(Native Method)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.database.CursorWindow.getString(CursorWindow.java:438)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at com.absind.resumebuilder.DbHelper.returntitle(DbHelper.java:53)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at com.absind.resumebuilder.AddList.gettitleform_db(AddList.java:123)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at com.absind.resumebuilder.AddList.onCreate(AddList.java:42)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.app.Activity.performCreate(Activity.java:5389)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2246)
  11-25 13:08:58.175: E/AndroidRuntime(17274):    ... 11 more
  </code></pre>