samedi 12 mars 2016

I am getting cursor out of bounds exception Android SQLite

I am getting this exception because the view i am clicking is requesting position from cursor but the cursor is already finished and is at the last position.

  1. my cursor sets all VideoViews and finished.

  2. when i click on Videoview I am using the cursor to find the current position of the cursor which was during the time i set the videoView

ex. when i click on the second video to play I want the 2nd row to be returned using the same cursor which populated all the views. but as the cursor is done populationg those already so the position i get from the cursor is already out of bounds.

The problem is-

{
// I use cursor here to set 10 videoViews in a layout
//    { 
       //I have set a touch listner to VideoView
       //here i click on the nth video to to get current pos of cursor
       // get OOB exception as when i click on the view the cursor is already
       // finished setting the views and is out of bounds
      }

}
//now the cursor has moved to out of bounds as it is finished setting all videos at last.

now i need some solution so that i can know which videoView I clicked and what was the position of cursor at that time when the videoView was set.

Aucun commentaire:

Enregistrer un commentaire