2013-02-21 53 views
0

嗨我想使用從其他應用程序使用的代碼,也許它不工作,因爲是爲ICS。OpenYouTubePlayerActivity.class錯誤不顯示視頻

我使用OpenYouTubePlayerActivity-1.2 lib在我自己的應用程序上顯示視頻,而不是打開Youtube應用程序。要做到這一點,我只有這一個用途:

String url = "http://www.youtube.com/watch?v=xb1BL_HNvZY"; 
Uri uri = Uri.parse(url); 
String videoId = uri.getQueryParameter("v"); 

Intent videoIntent = new Intent(null, Uri.parse("ytv://" + videoId),getActivity(),OpenYouTubePlayerActivity.class); 

我嘗試使用的例如「YTV:nasdasd」無//但鴕鳥政策修復它。

的錯誤提示:

02-21 23:08:39.293: E/AndroidRuntime(13304): FATAL EXCEPTION: main 
02-21 23:08:39.293: E/AndroidRuntime(13304): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.app.LoadedApk.makeApplication(LoadedApk.java:504) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.app.ActivityThread.access$1300(ActivityThread.java:141) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.os.Handler.dispatchMessage(Handler.java:99) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.os.Looper.loop(Looper.java:137) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.app.ActivityThread.main(ActivityThread.java:5039) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at java.lang.reflect.Method.invokeNative(Native Method) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at java.lang.reflect.Method.invoke(Method.java:511) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at dalvik.system.NativeStart.main(Native Method) 
02-21 23:08:39.293: E/AndroidRuntime(13304): Caused by: java.lang.NullPointerException 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:379) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.app.LoadedApk.getClassLoader(LoadedApk.java:322) 
02-21 23:08:39.293: E/AndroidRuntime(13304): at android.app.LoadedApk.makeApplication(LoadedApk.java:496) 
02-21 23:08:39.293: E/AndroidRuntime(13304): ... 11 more 

回答

0

最後我用的是新的YouTube API

+0

你如何修復它。你可以發佈解決方案嗎?獲得同樣的問題。 – 2016-04-28 04:42:18