0

I am using VideoView to play video files. Now i want to stop current playing video and play another video file.. I used videoview.stopPlayback(); then set new URI to that videovideo and start play but 'm getting

java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.<init>(Handler.java:121)
at android.widget.Toast$TN.<init>(Toast.java:322)
at android.widget.Toast.<init>(Toast.java:91)
at android.widget.Toast.makeText(Toast.java:238)
at com.network.video.player.MainVideoActivity.PlayNext_Video(MainVideoActivity.java:451)
at com.network.video.player.ConnectToServer$HandleClientThread.Delete_file(ConnectToServer.jav a:117)
at com.network.video.player.ConnectToServer$HandleClientThread.run(ConnectToServer.java:245)
at java.lang.Thread.run(Thread.java:856)

Does anyone know how to stop current video & play new video file in android??

Arjun Kanti
  • 101
  • 2
  • 4
  • 12
  • you are displaying a toast in a Thread. That's why you are getting this error. Not because of playing another video – user936414 Jan 08 '13 at 08:31
  • Ya, i used Toast. Now i removed that but i'm getting exception 'Can't Play the file : Only the original thread that created a view hierarchy can touch its views. android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.' 'm calling videoview.stopplayback() from different class.. – Arjun Kanti Jan 08 '13 at 09:29
  • No.. In main Activity 'm playing video and calling stopplayback from another class.. Video stopped but new file is not playing?? Getting exception for that.. – Arjun Kanti Jan 08 '13 at 09:35

0 Answers0