I want to make a function on my application that will know whether it is a tablet or a mobile phone.
To if this is a tablet, it is in setContentView(R.layout.movie_activity); changed to movie_activity2 .
I want to make a function on my application that will know whether it is a tablet or a mobile phone.
To if this is a tablet, it is in setContentView(R.layout.movie_activity); changed to movie_activity2 .
You are in the wrong direction . The fact is, I would venture to suggest that you need to show content that is differently located on different sized devices.
For this there are different qualifiers for layouts - ( layout-mdpi, layout-hdpi, layout-small and etc.). For the tablet, you need to specify the following qualifier - layout-w600dp (you can play with the size).
Once you have conceived different layout- s, then I suppose they differ not only in line-up, but also in content. For example, on the tablet there is an add. views with aidishniki, this is also solved with the help of checks in the code or a special viewview - ViewStub.
Source: https://ru.stackoverflow.com/questions/455428/
All Articles