CardboardView does not have the right size - android

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.

Related

Camera layout bug

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.

Camera preview shows unwanted tiles only on Android 4.2.2 (S4, full HD screen)

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.

Custom app installed onto Galaxy Nexus doesn't look anything like it should

I am developing an app in Android that I hope to release. I've got most of my GUI done, but it does not look even close to correct on the device when installed and opened. I have a screenshot of how it looks, and a screengrab of how it should look (taken from the Emulator in Eclipse) at the links at the bottom of this post. It's best to take a look at the two images rather than me try to describe how screwed up the app becomes on my device.
I had a friend with the exact same device, including hardware and Android version, and his loads up just fine. Does anyone have any idea what's going on here? Both devices are Galaxy Nexuses, running Android 4.0.2, GSM on AT&T (unlocked).
Installed on my device: http://i.stack.imgur.com/x66Jo.png
In the emulator: http://i.stack.imgur.com/qE0J6.png
I've seen this occur in some Galaxy Nexus' and I put it down to a bug/glitch in the OS on that Galaxy Nexus. Try a Factory Reset of your Galaxy Nexus, if that fails, try reinstalling the current OS version you have (if you can get your hands on it), if that fails, get it fixed under warranty.
Does your app use multiple activities?
Can you compare on your two devices if this setting is the same?
Settings > Developer Options > Don't keep activities checkbox.
I realise this is an old question now but I was having the same problem as you and stumbled across a solution. I didn't particularly want to factory reset my phone as per straya's instructions, so I started playing around options in the Settings > Developer Options menu.
As it turns out, this problem occurs for some applications if you have the Force GPU rendering option checked. Disable this (I'm not sure why it was enabled anyway) and everything displays as it should.

Small font size in Android emulator

Sometimes I notice the Android emulator starts with a very small font size. This seems to happen randomly. Other times it has a normal font size.
I use ADT 10.0.1.
Do you know what is the problem?
This happens very often, and although I'm not sure about the exact reason behind this, it seems that somehow the wrong density was detected for this and resources for a lower dpi is loaded inside a higher dpi emulator. That's why everything is smaller, but the layout works properly and aligns things at their own places. And you're right: when this happens, network doesn't work in emulator! These two things seem unrelated, but my guess is that emulator fails at loading config for the current virtual machine successfully, and that includes density and network capabilities.
Anyways, there doesn't seem to be any official info on this, and similar reports in android-developers mailing list didn't get any response for developers of Android, although this is a very popular bug.
And the solution right now is only restarting the emulator. Sometimes you have to do this more than once, but finally it works.
Make sure your computer's display resolution can satisfy your emulator's exact resolution. If you are using Mac with Retina Display, this problem may occur. Try changing display resolution via Display settings.

change image of phone on emulator

I need to make a screencast of an app to present to a client, but need it to look better than the ugly red phone or the various other incarnations of the emulator. Is there a way to swap out that image?
Also would be great to get rid of the keyboard that displays next to it and make the window borders go way (since I have to capture it full screen on a mac, unfortunately, I can't crop it tight).
When you create an AVD, you can specify a different skin to use. Besides the ones available by default, there are also a bunch on the web for various devices. You can search for "[phone name] emulator skin" to find a variety, but here are a couple of examples:
Nexus One
Nexus S
The Motorola MOTODEV site (http://developer.motorola.com/docstools/tools/) has addons for nearly every one of our released phones. Registration is required. Most of the addons are full system images, which should work or you could extract out the skin for your own uses. There is a "skin only" addon for the upcoming XOOM tablet that uses Gingerbread for the runtime.
Good luck

Categories

Resources