ジンジャーブレッドでyoutubeapiStandAlonePlayerActivityを実行しようとすると、ActivityNotFoundExceptionエラーが発生します。ICSで正常に動作する場合
これが私の丸太猫です
01-23 15:34:28.071: E/AndroidRuntime(3378): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.android.youtube.api.StandalonePlayerActivity.START (has extras) }
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1545)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1515)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.app.Activity.startActivityForResult(Activity.java:2988)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:701)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.support.v4.app.Fragment.startActivity(Fragment.java:787)
01-23 15:34:28.071: E/AndroidRuntime(3378): at com.example.demo.TipsFragment$2.onClick(TipsFragment.java:143)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.view.View.performClick(View.java:2533)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.view.View$PerformClick.run(View.java:9320)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.os.Handler.handleCallback(Handler.java:587)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.os.Handler.dispatchMessage(Handler.java:92)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.os.Looper.loop(Looper.java:150)
01-23 15:34:28.071: E/AndroidRuntime(3378): at android.app.ActivityThread.main(ActivityThread.java:4389)
01-23 15:34:28.071: E/AndroidRuntime(3378): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 15:34:28.071: E/AndroidRuntime(3378): at java.lang.reflect.Method.invoke(Method.java:507)
01-23 15:34:28.071: E/AndroidRuntime(3378): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
01-23 15:34:28.071: E/AndroidRuntime(3378): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
01-23 15:34:28.071: E/AndroidRuntime(3378): at dalvik.system.NativeStart.main(Native Method)
これが私がPlayerを起動するために使用したコードです
String vid=getYoutubeVideoId(vlink);
Intent intent=YouTubeStandalonePlayer.createVideoIntent(getActivity(),DEVELOPER_KEY, vid, 0,true,false);
startActivity(intent);
エラーが発生しますstartActivity
getYoutubeVideoID()コードは次のとおりです。
/*
* Getting id of video from url
*/
public static String getYoutubeVideoId(String youtubeUrl)
{
String video_id="";
if (youtubeUrl != null && youtubeUrl.trim().length() > 0 && youtubeUrl.startsWith("http"))
{
String expression = "^.*((youtu.be"+ "\\/)" + "|(v\\/)|(\\/u\\/w\\/)|(embed\\/)|(watch\\?))\\??v?=?([^#\\&\\?]*).*"; // var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
CharSequence input = youtubeUrl;
Pattern pattern = Pattern.compile(expression,Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(input);
if (matcher.matches())
{
String groupIndex1 = matcher.group(7);
if(groupIndex1!=null && groupIndex1.length()==11)
video_id = groupIndex1;
}
}
return video_id;
}