3 Strategies for Adding Tablet Support to Your Android Apps
There are three main strategies that you can use to make your Android phone app work on tablets. Each is perfectly reasonable and has its own set of advantages and disadvantages.
The first strategy is to make two different apps: one for phones and one for tablets. This sounds wasteful, but in fact it’s quite easy to use build variants to create two different apps from nearly the same codebase.
The advantage of this strategy is that you can keep all your shared code in one place but keep any phone-specific or tablet-specific code in separate directories. That way, the tablet code won’t need to be installed on phones where it won’t be used, and vice versa. The disadvantage of this strategy is that you need to manage two APKs, one for phones and one for tablets, every time you make a new release of your app.
The second strategy is to use a single app for both types of devices, but use different activities and choose between them when you launch the app. For example, the phone app might have a TaskListActivity which shows a list of tasks, and the tablet might have a TaskListAndEditActivity which shows a list of tasks, but also shows the edit fragment next to the list.
You would then add a special LaunchActivity which would be your app’s main launcher activity in the AndroidManifest. At startup, the LaunchActivity would quickly detect if you were on a tablet or on a phone, and start the appropriate activity before finishing itself. It would happen so fast that users would never even see the LaunchActivity itself.
The advantage of this strategy is that your app will still appear as a single app in the Google Play Store. The disadvantage is that all the phone code will also be installed on all your tablets, and vice versa.
The third strategy is to use the exact same activities on both phones and tablets, but to change the layouts for each type of device. This can work great for simple apps. The advantage of this strategy is that you don’t need to worry about writing additional activities to handle different device types. The disadvantage is that your phone and tablet code can start getting tangled in your activities, potentially making the activities complicated.