title: getting values from column in database
body: <p>I am getting values from the column "threadid" in the database.Problem is that it gets the value from the previous record/row. and when I try to get the first record my app crashes,, How to tackle this problem and whats the issue?</p>
  
  <pre><code>long id;
  long threadid = datasource.getthreadid(id);
  Toast.makeText(getActivity(), String.valueOf(threadid), Toast.LENGTH_SHORT).show();
  
  public long getthreadid(long id)
    {
  
        String ide=String.valueOf(id);
        String queryz = "SELECT " + MySQLiteHelper.COLUMN_THREADID 
                  + " FROM " + MySQLiteHelper.TABLE_NAME 
                  + " WHERE " + MySQLiteHelper.COLUMN_ID + "=" + ide;
        Cursor cursor = database.rawQuery(queryz, null);
        cursor.moveToFirst();
       // cursor.moveToPosition(Integer.parseInt(String.valueOf(id)));
       long threadid= cursor.getLong(cursor.getColumnIndex("threadid"));
  
        cursor.close();
      return threadid;
  
    }
  </code></pre>