Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8226365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:44:26+00:00 2026-06-07T15:44:26+00:00

I have two android devices for testing. One is with resolution 480×320 and other

  • 0

I have two android devices for testing. One is with resolution 480×320 and other is with 800×480. I define different layouts in layout-normal and layout directories. I also tried it with layout-hdpi, layout-mdpi etc different combinations.

Is there a way to know from the log of somewhere that in which layout category a device falls just for debugging purposes. I would like to know layout file from which directory is used at runtime. If not then could someone tell me the right combination of layout directories for two devices with the pre-mentioned resolution.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:44:27+00:00Added an answer on June 7, 2026 at 3:44 pm

    To find which layout (from layout-ldpi, layout-mdpi folder etc…) is used during runtime. You can use the tag attribute on your layout. For example let’s say you have defined two layouts for different screens, the one in layout-mdpi folder and the other in layout-hdpi folder. Something like this:

    <?xml version="1.0" encoding="utf-8"?>
    <!--Layout defined in layout-mdi folder-->
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/MainLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:tag="mdpi"
        android:orientation="horizontal" >
    
        <!-- View and layouts definition-->
    <!LinearLayout>
    

    And:

    <?xml version="1.0" encoding="utf-8"?>
    <!--Corresponding Layout defined in layout-hdi folder-->
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/MainLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:tag="hdpi"
        android:orientation="horizontal" >
    
        <!-- View and layouts definition-->
    <!LinearLayout>
    

    To check which layout is used during runtime, you can use something like this:

    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.MainLayout);
    if(linearLayout.getTag() != null) {
    
       String screen_density = (String) linearLayout.getTag();
    }
    
    if(screen_density.equalsIgnoreCase("mdpi") {
       //layout in layout-mdpi folder is used
    } else if(screen_density.equalsIgnoreCase("hdpi") {
       //layout in layout-hdpi folder is used
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two Android devices. One is acting as a server and the other
Is there a way to have two different Java code for one Android app?
I have two Android applications with a similar functionality but different drawables and layouts.
In my Android project, I have 2 Activities. One is MyProject and the other
I have Skype ( 2.8.0.920 ) installed on two Android devices. The first device
I have a basic audiorecord-audiotrack, udp packets voice chat between two android devices. It
I have two device: HTC Desire with Android 2.2 Froyo and HTC Evo 3D
I have two android applications. The apks are Hello.apk and Fonts.apk I would like
I have two android applications that I have developed. I need to compare the
Consider the following situation: I have two android projects named P1 and P2 which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.