title: Cursor to String
body: <p>I'm new to android, and I don't know why I am getting CursorIndexOutOfBoundsException: Index 0 requested with a size of 0. I'm trying to display it on another class using listview. Here are my codes:</p>
  
  <pre><code>public void onItemClick(AdapterView&lt;?&gt; arg0, View view, int position,
          long id) {
      // TODO Auto-generated method stub
  
      position = position + 1;
  
      Cursor a = MainActivity.sqldb
              .rawQuery("Select name from " + MainActivity.tblpb
                      + " where _pid = " + position + ";", null);
  
      String aa = a.getString(a.getColumnIndex("name"));
  
  
      Cursor b = MainActivity.sqldb
              .rawQuery("Select phone from " + MainActivity.tblpb
                      + " where _pid = " + position + ";", null);
  
      String bb = b.getString(b.getColumnIndex("phone"));
  
      Intent next = new Intent (this, ThirdActivity.class);
      startActivity(next);
  
  }
  </code></pre>
  
  <p>I know that there's something really wrong here. And I wonder what it is. </p>
  
  <p>Create Table:</p>
  
  <pre><code>sqldb = this.openOrCreateDatabase(dbpb, MODE_PRIVATE, null);
      sqldb.execSQL("CREATE TABLE IF NOT EXISTS "
              + tblpb
              + " (_pid INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR, phone INTEGER);");
  </code></pre>
  
  <p>Insert Table:</p>
  
  <pre><code>sqldb.execSQL("Insert into " + tblpb
                          + " (name, phone) Values ('" + x + "' , '"
                          + y + "' );");
  </code></pre>