Is there a way to have two different Java code for one Android app? One targeting phone devices and the other targeting tablet devices.
For example, something like HomeActivity.java and HomeActivity-large.java
Basically I would like to make an Android app that has different layout following its resolution.
I know I can use layout-large to have a specific layout for large devices. I'm not sure how to have a specific logic for tablets and another one for phone targets.
The reason I want to do that is that I would like to make an API call on a screen that I don't want to do on phone.
As an alternative way, I've thought in using a boolean (I'm not sure which one) to test what kind of device the app is running on. But I'm afraid it could get messy.
Another thing could be to make a library with all the functionalities of my app and then two different apps using the library. The problem with that solution is that some code is gonna get replicated.
Any suggestion?