When I click on a ListView item then I got following message:
How can I read out the item and get the items name to a string?

android.database.sqlite.SQLiteCursor@40706330

```
public void onListItemClick(
ListView parent, View v,
int position, long id)
{   
    Object o = this.getListAdapter().getItem(position);
    String keyword = o.toString();

    Toast.makeText(this, keyword, Toast.LENGTH_SHORT).show();

} 

```

This way I can read the position from the item:

```
    public void onListItemClick(
ListView parent, View v,
int position, long id)
{   
    open_database_rw();

    Object itemId = this.getListAdapter().getItemId(position);
    String item = itemId.toString();

    Toast.makeText(this, item, Toast.LENGTH_SHORT).show();

}  

```

Now I like to read out the selected data into a toast. I tried it this way but it didn't work:

```
public void onListItemClick(
ListView parent, View v,
int position, long id)
{   
    open_database_rw();

    Cursor cursor = db.query("tbl_homework", new String[] {"hw"}, 
            "_id = 1", null, null, null, null);

    int column = cursor.getColumnIndex("hw");
    String item = cursor.getString(column);

    Toast.makeText(this, item, Toast.LENGTH_SHORT).show();

} 

```

Errormessage: 
android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1

Problem has been solved! I had to move the cursor to first
cursor.moveToFirst();

Full working code:

```
public void onListItemClick(
ListView parent, View v,
int position, long id)
{   
    open_database_rw();

    Object itemId = this.getListAdapter().getItemId(position);
    String item = itemId.toString();

    Cursor cursor = db.query("tbl_homework", new String[] {"hw"}, 
            "_id =" + item, null, null, null, null);

    cursor.moveToFirst();
    int column = cursor.getColumnIndex("hw");
    String hw = cursor.getString(column);
    Toast.makeText(this, hw, Toast.LENGTH_SHORT).show();
}  

```