android-screen

How to know whether its a tablet or phone in android programmatically? [duplicate]

守給你的承諾、 提交于 2019-12-01 06:20:36
问题 This question already has answers here : Tablet or Phone - Android (30 answers) Closed 5 years ago . I would like to get to detect whether the given device is a tablet or phone in android.I have tried the two in the simulator but none worked. Both are here: First if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { //code } Second private boolean isTabletDevice() { if (android.os.Build.VERSION.SDK_INT >= 11) {

Android - How to dynamically change fragment layout

淺唱寂寞╮ 提交于 2019-11-30 20:47:06
I have a tablet app with an about fragment which displays my company's datas. I would like to change my layout dynamically with screen orientation while im on the page but i didn't found how yet. If someone got the solution, thanks in advance @Yume177, i found how to do it : @Override public void onConfigurationChanged(Configuration newConfig) { // TODO Auto-generated method stub super.onConfigurationChanged(newConfig); RelativeLayout rl = (RelativeLayout) findViewById(R.id.about); rl.removeAllViews(); rl.addView(View.inflate(myView.getContext(), R.layout.about, null)); } I have 2

Android Activity Not Showing When Screen is Woken Up and Lock Screen Not Disabling

一曲冷凌霜 提交于 2019-11-30 20:20:28
I have a BroadcastReceiver that starts an Activity . If the Activity is started while the screen is on, it displays and everything is fine. However, on ICS and JB devices (I haven't tested GB or HC but the issue doesn't exist with Froyo) if the Activity is started while the screen is off, the lockscreen is not disabled, and the activity is not shown when the phone is unlocked (either through unlocking it manually or with the code I put in for post Froyo devices). Why, on at least ICS and JB devices, does the lockscreen not get disabled without the mentioned code below, and why doesn't the

Android, concerning the User Interface design

大憨熊 提交于 2019-11-30 16:17:27
问题 the more I read the Supporting Multiple Screens guide, the more I get confused. if the layout folder's qualifier is based on size ( small, normal, large and xlarge ) and the drawable folder's qualifier is based on density ( ldpi, mdpi,hdpi and xhdpi ), then how can I specify the size of the drawables/images?? should all the images inside the drawable folders have the same size (based on the normal screen size) but different densities ( i.e. pic.png inside drawable.ldpi has the same width and

Android, concerning the User Interface design

最后都变了- 提交于 2019-11-30 15:58:08
the more I read the Supporting Multiple Screens guide, the more I get confused. if the layout folder's qualifier is based on size ( small, normal, large and xlarge ) and the drawable folder's qualifier is based on density ( ldpi, mdpi,hdpi and xhdpi ), then how can I specify the size of the drawables/images?? should all the images inside the drawable folders have the same size (based on the normal screen size) but different densities ( i.e. pic.png inside drawable.ldpi has the same width and height of pic.png inside drawable.mdpi but has different density)?? the problem is that each screen

Android Activity Not Showing When Screen is Woken Up and Lock Screen Not Disabling

人盡茶涼 提交于 2019-11-30 04:13:57
问题 I have a BroadcastReceiver that starts an Activity . If the Activity is started while the screen is on, it displays and everything is fine. However, on ICS and JB devices (I haven't tested GB or HC but the issue doesn't exist with Froyo) if the Activity is started while the screen is off, the lockscreen is not disabled, and the activity is not shown when the phone is unlocked (either through unlocking it manually or with the code I put in for post Froyo devices). Why, on at least ICS and JB

How to prevent automatic screen lock on android by code?

核能气质少年 提交于 2019-11-30 01:51:36
In my app there is a long loading process, and if the devices puts on the screen lock, my process stops for some reason. How can i prevent the device from automatic screen lock? you have to declare this uses-permission on AndroidManifest: <uses-permission android:name="android.permission.WAKE_LOCK" /> And in your code Activity: PowerManager powerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE); WakeLock wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Lock"); wakeLock.acquire(); Just remember to release this lock when your application is paused or

Android: Samsung Galaxy S3 screen size for layout

自闭症网瘾萝莉.ら 提交于 2019-11-29 17:12:51
问题 Is anyone out there testing on a Samsung Galaxy S3 yet? Specifically, does it have what is considered a large or normal screen for layout purposes? I have the Galaxy Nexus and it takes normal layouts, but I read the Galaxy Note is considered a large screen. Thanks in advance. 回答1: Here's a link to the complete specifications for the European version of the Samsung Galaxy S3. The screen is 720 x 1280 pixels and 4.8 in. diagonal. The American version is the same as far as the screen goes. 回答2:

Lock Android phone application to Portrait mode

情到浓时终转凉″ 提交于 2019-11-28 17:07:48
Can someone tell me how to lock my application to a portrait mode? Is it a simple configuration in the manifest file? techiServices Yes. Add android:screenOrientation="portrait" to the manifest under your main activity. <activity android:name=".yourActivity" android:screenOrientation="portrait"... /> Yes! It's an attribute of the activity tag: <activity android:name=".yourActivity" android:screenOrientation="portrait" ... /> Also, you may have to add the following to your activity element: android:configChanges="keyboardHidden" That way, the OS won't change the orientation when the user opens

Android : Save application state on screen orientation change

你离开我真会死。 提交于 2019-11-28 11:40:51
I have seen the following links before posting this question http://www.devx.com/wireless/Article/40792/1954 Saving Android Activity state using Save Instance State http://www.gitshah.com/2011/03/how-to-handle-screen-orientation_28.html How to save state during orientation change in Android if the state is made of my classes? I am not getting how should i override the following function : @Override public Object onRetainNonConfigurationInstance() { return someExpensiveObject; } In my application i have layout with one editext visible and other editext get visible when the data of first editext