Android RecyclerView using VideoView in ViewHolder -


i want play video using recyclerview , using recyclerview.smoothscrolltoposition() scroll page.

when recyclerview using videoview in viewholder, onbindviewholder(viewholder, position) position can't match recyclerview current position, can't control videoview.

adapter:

interface control {     int getcurrentposition() ; }  control control;  public recyclerview.viewholder oncreateviewholder() {     log.i(tag, "oncreateviewholder()...page: " + control.getcurrentposition() ); }  public void onbindviewholder(viewholder, position){     log.i(tag, "onbindviewholder()...position: " + position + ", page: " + control.getcurrentposition() );      int page = control.getcurrentposition();      // position maybe difference page value } 

activity:

int page;  void oncreate() {     adapter = new adapter(new adapter.control() {             @override             public int getcurrentposition() {                 return page;             }         }); }  void scroll() {     log.i(tag, "page: " + page );     recyclerview.smoothscrolltoposition(page); } 

log:

page: 0 oncreateviewholder()...page: 0 onbindviewholder()...position: 0, page: 0  page: 1 oncreateviewholder()...page: 1 onbindviewholder()...position: 1, page: 1 oncreateviewholder()...page: 1 onbindviewholder()...position: 2, page: 1  page: 2 oncreateviewholder()...page: 2 onbindviewholder()...position: 3, page: 2  page: 3 page: 4 onbindviewholder()...position: 4, page: 4 onbindviewholder()...position: 5, page: 4  page: 5 page: 6 onbindviewholder()...position: 6, page: 6 onbindviewholder()...position: 7, page: 6  page: 7 page: 8 onbindviewholder()...position: 8, page: 8 onbindviewholder()...position: 9, page: 8  page: 9 


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -