i program app android view youtube . have problem android studio. copy youtubeandroidplayerapi.jar folder libs , code in java fine , in xml has error
rendering problems following classes not found com.google.android.youtube.player.youtubeplayerview (fix build path, create class)
tip: try build project.
i try build project have same error. here code
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity"> <com.google.android.youtube.player.youtubeplayerview android:id="@+id/youtube_player" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#fff" android:padding="5dp" />
please :d tks
i recomend adding fragment programatically in code this:
youtubeplayersupportfragment videostreamingplayerfragment = youtubeplayersupportfragment.newinstance(); videostreamingplayerfragment.initialize(mdevkey, new playerinitializedlistener()); fragmenttransaction ft = getchildfragmentmanager().begintransaction(); ft.replace(r.id.container, videostreamingplayerfragment); ft.commitallowingstateloss();
in case want use view instead of fragment add function addview:
youtubeplayerview youtubeview = new youtubeplayerview(this); youtubeview.initialize(mdevkey, new playerinitializedlistener()); framelayout youtubecontainer = (framelayout) findviewbyid(r.id.youtubecontainer); youtubecontainer.addview(myoutubeview);
the activity operation must extend youtubebaseactivity
Comments
Post a Comment