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

  • SEARCH
  • Home
  • 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 8841767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:48:10+00:00 2026-06-14T10:48:10+00:00

When I run my android application I am calling a method to check if

  • 0

When I run my android application I am calling a method to check if the app is being run on a tablet using:

public boolean isTablet(Context context){
  boolean xlarge = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == 4);
  boolean large = ((context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)== Configuration.SCREENLAYOUT_SIZE_MASK);
  return(xlarge || large);
} 

if the method returns true(i.e. the device satisfies one of these conditions)

I set my theme to a Dialog theme via:

setTheme(R.style.MyTheme);

where MyTheme is a theme that inherits from the parent Theme.Holo.Light.Dialog

This logic works fine however it gives me a weird effect in the background. The Calling intent is completely blacked out, whereas if i just set the theme in the manifest the background is only slightly greyed out.

Update – code added

 private Context mClassContext = this;
 @Override
 public void onCreate(Bundle savedInstanceState){
     if(isTablet(mClassContext)){
       setTheme(R.style.MyTheme);
     }
  super.onCreate(savedInstanceState);
  setContentView(R.layout.myLayout);
}

How do I replicate this?

  • 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-14T10:48:11+00:00Added an answer on June 14, 2026 at 10:48 am

    I have seem to found the answer to my own question.

    To avoid the black background:

    In the android manifest set all your activities that could be dialogs(if it is a tablet) to the dialog theme:

    then in onCreate add this else case to change it for non-tablet devices(i.e phones)

    if(isTablet(mContext)){
    setTheme(R.style.myDialogTheme);}
    else{ 
      setTheme(R.style.MyTheme);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the monkey tool to run a test of my Android application. For
I have developed the Hello World Android application using Eclipse. I can run the
Hai am Calling the webservice in my android application am using android version(r-18).but i
My android application has several warnings of the following form when I run it
I recently uploaded my application to the android market however it's refusing to run
When testing on real Android devices, I run my application from within Eclipse and
In an Android application I run a task in a separate thread. While the
i need to write simple android application that run on the background and read
I need to run a periodic task in an Android application. I currently use
I developed application on 1.6.in manifest i gave: <uses-sdk android:minSdkVersion=3 android:targetSdkVersion=4/>. When I run

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.