When I launch the Android application, I call the method to check if the application is running on the 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 (that is, the device satisfies one of these conditions)
I installed the topic in the conversation topic via:
setTheme(R.style.MyTheme);
where MyTheme is a theme that inherits from the parent Theme.Holo.Light.Dialog
This logic works great, but it gives me a weird effect in the background. The call wash is completely obscured, whereas if I just set the theme in the manifest, the background does not stand out a bit.
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 to do it?
source share