i want play a lot of videos in a ListView. just like the app called "vine". i use the TextureView and MediaPlayer to display a video. we know that the ListView will reuse the view. because of this mechanism i get a problem. for example : in the visible area i am playing a video A, so ,when i scroll up , video A will be invisible, so i want to play video B , the ListView may reuse the view for play Video A, so ,when i start play video B, first the view will show the image of A , then refresh to content of Video B. that is my problem. i don't know how to clean the content of TextureView . does any body tell me how to solve this problem . thank you very much!
Asked
Active
Viewed 2,447 times
1 Answers
3
please use removeView(View v) from ViewGroup class. Then re-initiate the view with the right content.

KarelG
- 5,176
- 4
- 33
- 49
-
3is there another way to solve this problem. i want to use the power of reuse view in the ListView. re-initiate new view may consume some computing power – smile2you Jul 20 '13 at 12:55
-
1@smile2you Did you figured out solution to the problem ? I am trying to play videos in a listview just like vine. When i use texture view to play a single video in an activity, it works fine, however if i try to play it in listview, it never works. Surface Texture is always null . – aNoviceGuy Oct 09 '13 at 02:29
-
@aNoviceGuy did you find any solution? I am trying to use VideoViews & ListView but they are simply not playing well with each other. – Piotr Feb 24 '14 at 22:33
-
@Piotr As we were close to deadline, i could not spend much time over it so we changed the design a bit and added a play button over every video. So now user can click the play button to play. – aNoviceGuy Mar 13 '14 at 20:15
-
can someone please elaborate a little more this answer? – desgraci Dec 02 '14 at 03:04
-
@smile2you are you able to load and play multiple videos in a listview like vine or instagram. I want to implement the same functionality like playing videos in listview when it is visible and pause when user scroll and play next video that is visible. Can you suggest me any code/tutorial or provide me any sample? – Nouman Bhatti Jun 18 '15 at 11:37