I'm trying to create an AndroidStudio project that supports both Android (phone/tablet) and AndroidTV. The goal is to have similar functionality on the Phone/tablet and AndroidTV, while one not needing the other to operate, and reusing code.
When I create a new project, do I:
- a) Put a check mark on both "Phone and Tablet" as well as "TV"?
- b) Check mark on "Phone and Tablet" and retrofit based on this guide: https://developer.android.com/training/tv/start/start.html
- c) Check mark on "TV" and retrofit a Main Activity?
I've tried b) but both the phone (5.0) and ADT-1 just get the same layout.
Below is my manifest file (MainActivity is placed before MainActivityTV). When I run it, both phone and ADT-1 load the phone layout. But, when I put MainActivityTV before MainActivity, both my phone and ADT-1 load the leanback layout. How do I make it so that phone only loads MainActivity, and the ADT-1 only loads MainActivityTV?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidretrofitwithtv" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:banner="@drawable/app_icon_your_company"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivityTV"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|navigation"
android:theme="@style/Theme.Leanback">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DetailsActivity" />
<activity android:name=".PlaybackOverlayActivity" />
<activity android:name=".BrowseErrorActivity" />
</application>
</manifest>