title: Cursor index out of bound exception on listview cllick event
body: <p>I am performing a sqlite database operation on click event of listview as shown below:</p>
  
  <pre><code>ListView lv1 = (ListView) findViewById(R.id.listView1);
  lv1.setOnItemClickListener(new OnItemClickListener() {
              public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
                      long arg3) {
                  String out = arg0.getItemAtPosition(arg2).toString();
                  SQLiteDatabase db = openOrCreateDatabase("mynotedb", MODE_PRIVATE, null);
                  String sql = "select description from notecont where title='"+out+"'";
                  Cursor c1 = db.rawQuery(sql, null);
                  int n = c1.getColumnIndex("description");
                  data = c1.getString(n);
                  if(data.equals(""))
                  {
                      data="";
                  }
                  c1.close();
                  send(out, data);
              }
          });
  </code></pre>
  
  <p>But on running it gives me cursor index out of bound exception. I am also mentioning the details of logcat :</p>
  
  <pre><code>07-15 22:24:05.791: E/AndroidRuntime(6932): FATAL EXCEPTION: main
  07-15 22:24:05.791: E/AndroidRuntime(6932): android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:41)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at com.example.notepad.MainActivity$2.onItemClick(MainActivity.java:65)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.widget.AdapterView.performItemClick(AdapterView.java:284)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.widget.ListView.performItemClick(ListView.java:3513)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.os.Handler.handleCallback(Handler.java:587)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.os.Handler.dispatchMessage(Handler.java:92)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.os.Looper.loop(Looper.java:123)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at android.app.ActivityThread.main(ActivityThread.java:3683)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at java.lang.reflect.Method.invokeNative(Native Method)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at java.lang.reflect.Method.invoke(Method.java:507)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  07-15 22:24:05.791: E/AndroidRuntime(6932):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Please suggest a fix.</p>