I am new to android. I am trying to play a video from sdcard.
this is the sample code I have used:
  public class videoa extends Activity {
  /** Called when the activity is first created. */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      this.setContentView(R.layout.main);
      VideoView videoView = (VideoView)this.findViewById(R.id.videoView);
      MediaController mc = new MediaController(this);
      videoView.setMediaController(mc);
      // (1) Web
      //videoView.setVideoURI(Uri.parse(
      //"http://www.bogotobogo.com/Video/sample.3gp"));
      //"http://www.bogotobogo.com/Video/sample.mp4"));
      //"http://www.bogotobogo.com/Video/sample.mov"));
      /* (2) SD card */
      //videoView.setVideoPath("/sdcard/sample.3gp");
      videoView.setVideoPath("/sdcard/robot.avi");
      //videoView.setVideoPath("/sdcard/sample.mov");
      // videoView.开发者_如何学GosetVideoURI(Uri.parse(
        //"file:///sdcard/sample.mov"));
      videoView.requestFocus();
      videoView.start();
  }
}
I have launched manually And set the target as -sdcard C:/android-sdk-windows/tools/sdcard.img.
When i have launched the emulator it shows Video Cannot be Displayed.
Please help me out.
You try interchanging the 2 lines
 final String MEDIA_PATH = new String("/sdcard/robot.avi");
 VideoView videoView = (VideoView)this.findViewById(R.id.videoView);
 MediaController mc = new MediaController(this);
 videoView.setVideoPath(MEDIA_PATH);
 videoView.setMediaController(mc);
 videoView.requestFocus();
 videoView.start();
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论