나는이 코드 부분을 Acer Liquid (진저 브레드), Archos 43 (froyo), Archos 32 (froyo) 등의 다른 장치에서 완벽하게 작동합니다.MediaController.show()에서 오류가 발생했습니다
VideoView videoView = (VideoView) findViewById(R.id.videoView1);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
File filevideo = new File(Environment.getExternalStorageDirectory() + "/edizionitsm/firenze/map_" + map_n + "/",filename + "_" + language + ".mp4");
Uri video = Uri.fromFile(filevideo);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
...하지만 Point of View Pro Tab2 (진저 브레드)에서 활동 시작 부분에 충돌이 발생합니다.
11-09 14:12:59.640: E/AndroidRuntime(31433): FATAL EXCEPTION: main
11-09 14:12:59.640: E/AndroidRuntime(31433): java.lang.RuntimeException: Unable to start activity ComponentInfo{edizionitsm.archeoplayer/edizionitsm.archeoplayer.Player}: java.lang.NullPointerException
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.os.Looper.loop(Looper.java:123)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-09 14:12:59.640: E/AndroidRuntime(31433): at java.lang.reflect.Method.invokeNative(Native Method)
11-09 14:12:59.640: E/AndroidRuntime(31433): at java.lang.reflect.Method.invoke(Method.java:507)
11-09 14:12:59.640: E/AndroidRuntime(31433): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-09 14:12:59.640: E/AndroidRuntime(31433): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-09 14:12:59.640: E/AndroidRuntime(31433): at dalvik.system.NativeStart.main(Native Method)
11-09 14:12:59.640: E/AndroidRuntime(31433): Caused by: java.lang.NullPointerException
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.widget.MediaController.disableUnsupportedButtons(MediaController.java:640)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.widget.MediaController.show(MediaController.java:674)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.widget.MediaController.show(MediaController.java:631)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.widget.VideoView.start(VideoView.java:962)
11-09 14:12:59.640: E/AndroidRuntime(31433): at edizionitsm.archeoplayer.Player.onCreate(Player.java:48)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-09 14:12:59.640: E/AndroidRuntime(31433): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
11-09 14:12:59.640: E/AndroidRuntime(31433): ... 11 more
문제는 mediacontroller 클래스의 show() 함수에 있습니다. 어떻게 해결할 수 있습니까? 감사합니다.
코드 줄과 여기에 나오는 모든 관련 코드는 무엇입니까? edizionitsm.archeoplayer.Player.onCreate (Player.java:48)? –
문제가 발생했습니다 :'Cause : java.lang.NullPointerException 11-09 14 : 12 : 59.640 : E/AndroidRuntime (31433) : android.widget.MediaController.disableUnsupportedButtons (MediaController.java:640)'. 나는 동일한 예외 (Android 4.0.3에서)를 얻었지만, 명시 적으로 mediaController.show()를 호출 할 때만 예외가 발생합니다. 그렇지 않은 경우 작동하지만 미디어 컨트롤러를 자동으로 표시하지 않습니다. 적어도 동영상을 터치해야만하지만 적어도 충돌은 없습니다. – Ridcully