I'm using a barcode scanner library wich uses a camera layout, the usual. I tried the library on three devices and it looks fine in all of them.
But in the fourth device, it looks like this.
I uploaded pictures instead screenshots because, when you make one, the bug doesn't appears on it. It just looks normal. This makes me think about some kind of GPU/Android bug or something like that, but I really don't know where this is coming from and how to fix it.
By the way, the devices I used testing are: Nexus 5 (6.0.1), Galaxy Young (4.1.2) and Doogee DG685 (4.2.2). In all of them the layout is perfectly showed. The bug only appears on a HoneyWell E70 (4.0.3).
Author has explained to me that it's caused by using SurfaceView instead of SurfaceTexture.
The library has a XML attribute to fix it:
app:zxing_use_texture_view="true"
But it's not documented. In the next release this option will be true by default.
Related
I'm developing an Android app... when I run it on my Motorola it runs ok, but when I launch it in my Samsung device, that has less screen size, the app doesn't show some buttons. It seems that the resolution is different in either both devices.
How can I configure my app so I don't have problems running in mostly devices?
As stated #abed in his answer, ConstraintLayout should be good for solving most of this issues, but you can never know that it will be fine on all devices.
Testing on multiple devices is one way to be sure, so if you expect that there will be problems, or that something should be different. You can easy see behavior on multiple devices inside android studio like this:
So just change phones with different resolution and observe behavior. If you want different behavior create new layout for that resolution.
when you build your layout Use <androidx.constraintlayout.widget.ConstraintLayout
check this https://developer.android.com/training/constraint-layout
I'm wondering why in every tutorial I watch the preview section looks like this: i.e it has the actual device shown as preview and has a button for linking it to an activity
When mine looks like this: for some reason doesn't have the device
I'm sure I've just not installed something correctly or not clicked a checkbox, or a version of something is wrong but after some googling i can't seem to work out what it is. Any help would be greatly appreciated.
Newer versions of Android Studio do not show the device bezel by default. Everything looks installed correctly.
Look at the Android Studio window title.
Your video is using 2.0 Beta, and your newer version just doesn't have the bezel.
You'll also notice there's different buttons around the screen preview area.
You could disable it in older versions, I'm not sure if it's completely gone but it was probably removed because it took up screen space and didn't serve much purpose
I'm creating an Android Cardboard app from scratch. The CardboardView is rendered in the wrong size. This happens both on the emulator, which emulates a Galaxy Nexus Kitkat, and on a real device, a Galaxy K Zoom.
In the LogCat, I get the following message (for the emulator):
E/CardboardViewNativeImpl: Surface size 656x872 does not match the expected screen size 1280x720. Stereo rendering might feel off.
In the layout, I'm using:
android:layout_width="fill_parent"
android:layout_height="fill_parent"
I also have a res\layout\dimens.xml that has the same contents as the res\layout\dimens.xml in the Treasure Hunt sample app.
I've found that the application takes the screen size from the device, and that some devices report their screen size wrongly.
However, the "Treasure Hunt" demo app works correctly on both the emulated and the real device.
Neither of the devices is rooted.
The problem is also mentioned on here and here, but not solved on either of these sites.
I also get some links from a site named quabr.com, but if they had the answer once it is no longer there.
The problem as it appears in the emulator:
It turned out that in the XML for my CardboardView there was the following attribute:
android:layout_marginTop="172dp"
It was probably put there by Android Studio for some reason, as I did not modify the CardboardView from the "Design" interface (in fact, Android Studio wouldn't let me).
Removing this attribute solved the problem, both on the emulator and on the real device. The error message no longer occurs in the LogCat.
My app runs with many devices but 2 users have send me simular images as below.
As far as I know the behaviour is only seen on Android 4.2.2 (Samsung S4).
On the full HD screen there seem to be 3 compressed tiles of 160x600 pixels.
I have tried an AVD with full HD screen but that fails to start.
On 4.03 devices I don't see this. I don't use tiles.
Does anybody have a hint what or where this goes wrong ?
This looks like a possible bug in the Android platform on Samsung's S4 devices with that particular Android version. My experience tells me that it's a very real possibility. It could also be that you do something wrong in your app that only causes actual problems on that version (and maybe even only on that device), but there is no indication of that from what you tell. Android 4.2.2 should be backwards compatible with 4.0.3, so in general it should work on the later version too, of course.
I would advice you (or anyone in the same situation) to try it out on other devices with the same Android version if possible. Also, double check that you're not violating anything in the Android API documentation.
Please add more info about what you're doing and how if you need more detailed answers. I guess you've probably found a solution or workaround by now, but still adding my answer here.
I'm currently developing an application with which a schedule can be retrieved and viewed. To display the schedule I used the TimeRulerView (and BlocksLayout and BlockView) java source files from the Google IO 2011 app because I liked the look and feel. Source code can be found here: https://github.com/underhilllabs/iosched2011 . (Google replaced there one with the code of IO2012).
Since my Galaxy Nexus updated tot Jelly Bean (4.1.1) yesterday the TimeRulerView (and/or one of the others) doesn't get shown anymore.
The weird thing is that they are actually still there, but there not visible. I can see a scrollbar of the length the timeruler normally has. Also when I normally click on an block in the view I get a little pop-up, and this still happens when not seeing the timeruler or a block.
I tested the original IO2011 app on my JB GN but nothing is visible there either, so the problem lies within (one of) the view(s) or the way JellyBean is rendering the view(s) (project butter maybe?).
See here ( https://dl.dropbox.com/u/7102660/TimeRulerView_JellyBean_problem.zip ) for screenshots on ICS (app working), JB (app not working) and the GoogleIO2011 app.
Could this be something to do with Hardware acceleration? I just recently ran into an issue on couple phones with ICS, but not all phones/devices were affected. Adding the hardwareAccelerated tag to my manifest didn't fix the issue either, and I had to define it on specific views that I did not want to be hardware accelerate. My solution used android:layerType="software" in my xml layouts and setLayerType(LAYER_TYPE_SOFTWARE, null) in the java code.
EDIT: Testing this more, it didn't fix my issue using setLayerType on Jelly Bean. Setting the layer type to software on ICS did fix my issue. The only way I could make the views show up was setting the whole application or specific activity to android:hardwareAccelerated="false".
Thanks to Chris answer I played around with hardware acceleration settings. I use the iosched2011 code as well and only had to remove the line android:layerType="software" from my BlocksLayout View inside the block_content.xml file .