0

I'm making an app for a project, and the layout is working well when I run a virtual device, being able to differentiate between normal and large screens, but when I try to run the app on a real phone it always shows the normal screen size layout and not the large one, no matter which phone I try running it on.

I tried uninstalling the app, restarting the phone, and nothing works. I checked out the manifest and it didn't seem to be the case.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="group1.project">

    <supports-screens
        android:largeScreens="true"
        android:normalScreens="true"
        android:xlargeScreens="true"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".TestAPI"
            android:label="@string/title_activity_test_api"
            android:theme="@style/AppTheme.NoActionBar"></activity>
        <activity
            android:name=".PackageDetails"
            android:label="@string/title_activity_package_details"
            android:theme="@style/AppTheme.NoActionBar"></activity>
        <activity
            android:name=".SignUp"
            android:label="@string/title_activity_sign_up"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity
            android:name=".ServiceInfo"
            android:label="@string/title_activity_service_info"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

UPDATE

I took a look at glucaio's comment, and ran the following lines of code:

if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
    Toast.makeText(this, "Large screen", Toast.LENGTH_LONG).show();
}
else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
    Toast.makeText(this, "Normal sized screen", Toast.LENGTH_LONG).show();
}

On the virtual device emulator, it says "Large screen", but on my phone it says "Normal screen", even though I am emulating my own phone... is it an issue with Android Studio maybe?

  • 1
    [This question](https://stackoverflow.com/questions/5015094/how-to-determine-device-screen-size-category-small-normal-large-xlarge-usin) might be helpful. –  Jun 03 '19 at 00:16
  • It helped on printing which screen size android studio thinks my phone is, but it's still confusing why it's saying my phone is normal sized... – Bruno Signorelli Domingues Jun 03 '19 at 01:10

0 Answers0