Issues on Android Screen Sizes - java

I am still trying to figure out a solution for this. Ive created a multiple layout on my res folder namely: layout, layout-sw480dp, layout-sw600dp, layout-sw720dp. Now testing it to real device which is (Samsung galaxy (7 inches) and Alcatel T10(7 inches)) they both go to layout-sw600dp but samsung seems much bigger than alcatel. Most of 7 inches tablet works fine except Samsung. Ive read this link Screen sizes and found out that
The original Samsung Galaxy Tab is an interesting case. Physically it is a 1024x600 7” screen and thus classified as “large”. However the device configures its screen as hdpi, which means after applying the appropriate ⅔ scaling factor the actual space on the screen is 682dp x 400dp. This actually moves it out of the “large” bucket and into a “normal” screen size. The Tab actually reports that it is “large”; this was a mistake in the framework’s computation of the size for that device that we made. Today no devices should ship like this.
My Samsung galaxy is 3.2 so I am sure that it fits on my requirements.
Does someone know how to handle this kind of problem?Like can I create a new folder for Samsung Galaxy only?
Sorry for my english, it is not my native language.

I struggled with the above issue for sometime and found that thr was no alternative for this in xml.
You must handle this during run-time, if you only want it for this specific model then u can get the model make during runtime here and then handle the scenario.
I dont see anyway u can have a special folder for samsung, if you find out,please do let me know :)

Related

Autofocus in Samsung S8+

A wrote an application using a camera (Camera2) some time ago. And it worked with Samsung S5 (Android 6). But with S8+ (Android 8) camera doesn't focus anymore. It's going from CONTROL_AF_STATE_INACTIVE to CONTROL_AF_STATE_ACTIVE_SCAN to CONTROL_AF_STATE_FOCUSED_LOCKED (and then cycles through last two states) but the camera doesn't focus.
But when for the first time I postpone autofocus start (for example for 1 - 2 seconds after opening camera device) camera focuses - but only this time. And then it backs to cycling through these states without focusing.
The only thing that helps is reopening camera device but it's unacceptable because of delay.
I was trying to use CONTROL_AF_MODE_CONTINUOUS_PICTURE instead of CONTROL_AF_MODE_MACRO and this works for S8 but doesn't work for S5 :/
Does anybody have an issue like this? I'll try to prepare SSCE but maybe somebody knows what to do?
this is a know glitch ...the Samsung forums have a possible solution:
https://us.community.samsung.com/t5/Galaxy-S8-Questions-and-Answers/Camera-Not-Focusing-and-Blurry-Photos/td-p/103058 - which appears to be a manufacturing / mechanical issue.
tapping the back might loosen the stuck lens (eg. while it switches the modes back and forth). I'd still check for the occasion, that it may still behave alike that when running on some other S8+ device. it's not exactly what one would expect from a brand-new smartphone, but there seems to be too little precision at the lens clearance. maybe try to RMA that device?

Background/UI for multiple devices

I’m new to Android programming and I’m stuck with a very specific problem. I want my application to run on multiple screen sizes and densities.
I have several real devices with different screen resolutions (Samsung Galaxy S7 Edge [xxxhdpi], Samsung Galaxy A5(6) [xxhdpi], Samsung Galaxy Note 10.1 tablet [xhdpi].
I made one background and scaled it down for every generalized density. I saved the files as “background.png” in separate folders like suggested in Supporting Multiple Screens.
After testing the APK on the devices, everything worked fine except the background on the S7. It will always load the next lower resolution bitmap (xxhdpi instead of xxxhdpi). I looked countless threads how to fix this problem but nothing worked so far.
The resolutions of my bitmaps are:
drawable-mdpi //320x480
drawable-hdpi //480x800
drawable-xhdpi //720x1280
drawable-xxhdpi //1080X1920
drawable-xxxhdpi //1440X2560
I hope that someone can help me on this one. I’m really losing my mind.
This is a little complex but I'll try to keep it simple. The android system chooses the right resources based on a lot of factors (which you can see when you create a new resource file under the "Available qualifiers" list) which you can group to create a resource shared by different configurations or use only one of them to specify one particular configuration. But you cannot control witch resource the device will use for the most part (there are some you can specify yourself ex: night mode). Your S7 probably uses the wrong resource because probably one of the settings for the display resolution is set at a lower setting (ex: battery saving modes lower resolution, gaming mode.. etc, accessibility settings). And if you want a tablet to use a different drawable then a phone then you should use the "smallest screen width" qualifier since you can specify different screen sizes in Dip(ex: sw320dp is a normal phone, sw440dp is a big pixel phone, sw720dp is a medium tablet and sw1048dp is a bigger tablet). Read more here
I'm also facing like this. My app only works on high resolution mobile only. Then I found that error. I placed my drawable on drawable-hdpi only . For every assets we have to place default drawable in drawable folder
put default drawable in that folder.
drawable
For handling images on the s7 device we can give height and width to the image view. Set the values for height and width from the dimens file. For handling s7 UI need to add the dimens-sw411 file and specify the height and width in that.

Android studio - Different device is using the same layout, but everything looks good only on one of them

I have 4 sets of layout xml and corresponding drawbles, including hdpi, tvdpi, xhdpi, and xxhdpi
I have 2 phones to test the app on, one is a virtual Nexus 5x, another one is a physical Galaxy Note 4
The xml layout works out perfectly on the Nexus 5x, but since (I assume) Note 4 has a smaller resolution / different ratio, the content is overlapping a little bit on it.
This app is very different than regular ones since it has a lot of image views in a relative layout arranged in a specific pattern. Problem is that the system is using xxhdpi resource and layout on both of the device. How do I fix it in a situation like this?
Thanks!
I faced the same problem few days ago.Use dimen.xml which is lacated under values folder.Make folder like values-sw600dp and make dimen.xml under this. Define all the relations in there and call it using #dimen/....
Android automatically will choose best match for your device.

Layout problems on Samsung Galaxy Y S5360

I am new to Android Development. I have recently developed an app that supports Screen sizes of 3" to 4"! The problem is that When I run my app on my HTC Wildfire S (3.2") it works find the screen visuals are fine to see and it gives best resolution.
But when I run the same app on my Samsung Galaxy Y S5360 (3") a small portion of the screen vanishes at the spot I mean the screen visuals are not so much visible to see and gives bad visuals of screen.
Why it is so when I have set the screen size as ranging from 3" to 4". I am using Relative Layout and in the Eclipse IDE the Screen is showing so well also.
HERE is the Eclipse IDE image
HERE is my Samsung Galaxy Y S5360 Image: sorry for poor image.
YOU can see the problem of text at the bottom of cell phone image how can i fix this? please help thanks in advance!
First- never trust the eclipse plugin. Its buggy, and its an estimation anyway. You can use it to see if you're roughly right, but never expect it to look like that ont he actual device, much less on all devices.
As for your problem- the screen on your device is too small for your layout. You either need to cut out whitespace or shrink something. If you can find out the exact resolution of this device you could make a special layout for devices of that resolution.
This is a standard problem in android UI design- you're developing for a lot of screen, some of which are very small. If you want it to work on everything, you have to be very careful with the amount of content and empty space on each screen and test against a variety of resolutions and physical sizes.
A good way to get around this is to size everything in dp. 1dp=1/160th of an inch. Then you know how big a screen you'll show on.
My 2 suggestions are as below
1.Can you try using scroll view for your content
2. apply full screen to your app & change the current layout of the app(if in case of linear layout)

Android Virtual Device Configurations

I'm just getting started with Android Dev.
Which Android phones should I add as virtual devices to make sure that my apps will work for the majority of people?
The only articles I've found from google were written 2 years ago, and I think the market share must've changed quite a bit by now, hence the phones listed there might no longer be in use as much.
Specifically I'd like to know which screen dimensions + Ram/memory I should provide to the phones for testing.
if your question is about which Android versions you want to support, you should check this link.
So basically you can use eclair (2.1) has the minimum supported version.
I highly recommend that you target the last version (Jelly Bean at the moment). It is a pretty good practice and this way you won't have to update your app to adapt it when JB will become more popular..
For my tests, I usually have a virtual machine with eclair or gingerbread and my phone with Jelly Bean.
edit : one very important clarification, in your app manifest. You will have to declare the minimum android version you support with android:minSdkVersion="XXX". the tag android:targetSdkVersion="XXX" is not here to tell on what version you are focusing, but to tell to the system if you have thought about the last versions. so you should always target the last one (16 at the moment). If for example you target gingerbread (api level 9 I think), then the terminal will assume that you did not adjust to the disparition of the menu button and display one, EVEN IF you don't even use it !! It is a very poor user experience.
As for the screens size to support, This link is very helpful (and whenever you have a question about android development the official website should always be your first destination). I think that the question is not really here are the screen sizes, let's make a layout for each one of them, but the contrary : here is how I want to display my app on a standard size phone (around 4.2" inches I would say), at which point in terms of dp do I need another layout because mine is either too cramped or has too much whitespace ?
If you really want to know what sizes to consider, somewhere between 4 and 4.5 inches is where you will find most high end smartphones of 2012. You will maybe need another layout for 3.5" or smaller screens.
In the superior dimensions, I would focus on 7" (Nexus 7, kindle, galaxy tab 7) and 10".

Categories

Resources