I developed an application that uses the YouTube android API to play a specific video in the application. At that time, I used 19 as a target API, as well as a target API 19. Now I need to change the design of the application switching to Material Design using the target API 22, as well as using AppCompat-v7 :22+ library . But YouTubeBaseActivity cannot be opened and the application will work. Below I will post what I have done so far.
EventDetail.java
public class EventDetail extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener { . . . protected void onCreate(Bundle savedInstanceState) {
Manifest file
<activity android:name="com.dev.apk.evente.al.EventDetail" android:icon="@drawable/ikona_projekte" android:label="@string/title_activity_event_detail" android:screenOrientation="portrait" android:theme="@style/Theme.TranslucentActionBar.ActionBar.Overlay" />
Layut File:
<RelativeLayout android:id="@+id/video_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dp" android:paddingLeft="23dp" android:paddingRight="23dp" android:paddingBottom="15dp" android:background="@drawable/event_background_block" > <TextView android:id="@+id/video_label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@color/white" android:gravity="left" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="Video" android:textColor="@color/VeryDarkGray" android:textSize="22sp" > </TextView> <com.google.android.youtube.player.YouTubePlayerView android:id="@+id/youtube_view" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/video_label" android:background="@color/white" /> </RelativeLayout>
Theme.xml File
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.TranslucentActionBar" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/Widget.ActionBar</item> </style> <style name="Theme.TranslucentActionBar.ActionBar" /> <style name="Theme.TranslucentActionBar.ActionBar.Overlay"> <item name="android:actionBarStyle">@style/Widget.ActionBar.Transparent</item> <item name="android:windowActionBarOverlay">true</item> <item name="colorPrimary">@color/evente_date_color</item> <item name="colorPrimaryDark">@color/evente_darken_color</item> </style> <style name="Theme.TranslucentActionBar.ActionBar.NoOverlay" parent="Theme.TranslucentActionBar.ActionBar.Overlay"> <item name="android:windowContentOverlay">@null</item> </style> </resources>
So, at the beginning it does not open, because the getActionBar() method returns Null, and then I changed it to getSupportActionBar() , but I did not recognize it. Then at the end, I changed this line as follows:
public class EventDetail extends AppCompatActivity implements YouTubePlayer.OnInitializedListener {
and this gives me the following error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myikub.al/com.dev.apk.evente.al.EventDetail}: android.view.InflateException: Binary XML file line
I am using Android Studio. Any idea would be appreciated.
Xhulio
source share