View not painted in a particular case - android

Dear Stack Overflow Users,
I am exploiting the Vintage Thermometer Template of this example (source code downloadable)
http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/
The only part of code I modified is the parametrization of the background image and the scale. My trial app works fine, both in the emulators (A phone 4.0' Android 4.3) and a Tablet (7.0' Android 4.4.2), and my phones, a Galaxy S Plus, and a Galaxy S III.
Since the code seemed to work I moved the view to another project where I'm using the Thermometer as Speedometer. Here again, everything is fine, both in the emulators and my Galaxy S Plus..., but not in the Galaxy S III!
What does work and what doesn't: everything works but the method drawHand() apparently. The hand is not painted for some reason. And just in this new project just with the Galaxy S III.
Now, everything in the layout and the code seems OK. I can't find cross compatibility issues anywhere. What I am asking you is maybe a more general question: something like this can actually happen and why? I searched for days for some similar issue without finding anything.
The view is inflated in the same way:
<com.example.speedometer.Tachimetro
android:id="#+id/tachimetro2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.5" />
inside a linear layout.
The manifest has nothing except the call for the main activity.
Galaxy S III is the only phone where something is not painted.
That's weird. Any idea what could be my next step?

Sorry for late response, but please try disabling hardware acceleration. One way to do that is to add the following to your manifest file:
<application android:hardwareAccelerated="false" ...>

Related solution to wthomas, instead of manually disabling hardware acceleration, in the mayou can target API 13 or less:
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="13" />
it was after API 14 (4.0 Ice Cream Sandwich) that hardware acceleration became "automatic."

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.

Forcing portrait orientation on Android stopped working after update to Lollipop, but only when debugging from Eclipse

I'm working on a libGDX application and based on this question I'm forcing portrait orientation in activity tag of AndroidManifest.xml like this:
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
This used to work fine on my devices until my Samsung Galaxy S4 got upgraded to Lollipop (5.0.1) from KitKat. Now it doesn't work on this device, while still working on others (with lower Android versions). On the S4 it just displays the application in landscape, ignoring rotation.
I was looking for differences in the 5.0 API that could explain this, but couldn't find anything.
Edit: I've just tried exporting my app to .apk and it displayed properly. Previously I was running it from Eclipse debug mode. It shouldn't be hard to pinpoint the issue, but I don't have time to investigate it at the moment.
Edit2: I've just tried running it from Eclipse on a different machine, where I have API 21 (so Lollipop) and it worked. However my working .apk has been exported on another machine, where I have API 20. It's really puzzling me. Might be something related to Android plugin versions, but I'm not sure if I will be able to pinpoint it.
try
android:screenOrientation="sensorPortrait"
I am not sure what your API level. But there was a google bug around this issue, which was fixed by API 16. If you are using anything earlier and if above line does not work, try
android:screenOrientation="sensorPortait"
instead.

View(Button) not getting visible when android:targetSdkVersion="17" not specified in manifest.xml for Android 4.1.2 (Samsung Galaxy s2 gt-i9100)

I have used Fragments and displaying a text animation in each fragment. Inside my Fragment activity I have taken a "next" button and have made it invisible. After the text animation is finished in a fragment, I am making the button visible and applying TranslateAnimation. When I test it on Samsung Galaxy s2 with Jelly Bean, the button is not getting visible on the first place. This happens when I remove the attribute,
android:targetSdkVersion="17"
from the manifest file. When I specify it back, the animation works fine and button gets visible too. However, it works find on any other device with Jelly Bean or even Samsung Galaxy s2 with ICS on it, even without specifying targetSdkVersion.
I wonder if anyone else is also facing the same problem and what could the problem be.
EDIT: In addition to the problem I mentioned, I also observed that when targetSdkVersion is not specified, the application crashes with outOfMemory error after changing several pages(Fragments) with Images in them. This is also particularly for Android OS version 4.1.2 (Jelly Bean).
Every mobile is not coming with core Android. it is customized for specified mobiles.
so it is always best practices to provide min and max version of android in manifest
You should use NOA library for ANdroid ANimation. This works great for Object ANimation....
Here is a link:

View(s) not visible on Android Jelly Bean

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 .

Problems with layout using <uses-sdk android:minSdkVersion - Android

I was publishing my first APP but i have a problem, I have tested my app with a lot of AVD then i tested with my phone(Galaxy S) and with my girlfriend phone (Galaxy 5) before publishing, when i tried to publish i received a msg to specify an API level requirement. then i put this code
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="7"
/>
then i tested in the AVD and i had no problem, but when i publish and tested in my Galaxy S, i encountered a crazy layout of my app, i do no why, so i go back to the Eclipse and tested direct to my galaxy S and get the same error, so i take this part of the code out and then tried again in my galaxy S and the layout is all OK, so i`m probably doing some thing wrong.
Many Thanks Sorry my poor English i`m from Brazil.
I think it is do with your layout defintion. What values have you used for layout_width and layout_height? (for layout and widgets)? You should use "wrap_content" of "fill_parent" and if you are forced to give exacts, give values in dip (100dip) rather than px or pix. Read this doco for more details http://developer.android.com/guide/practices/screens_support.html
It may be because your 2 phones have different android versions. Do this, create 2 emulators with exact same android version, screen size and density as your 2 phones and test and debug there.
Leave the minSDK declaration and get rid of the target SDK. You are using two separate declarations.
<uses-sdk android:minSdkVersion="4"/>
This is the only one you need.
I have seen this too. My app runs on everything from api level 4 and up. When I add
<uses-sdk android:minSdkVersion="4"/>
to my manifest and run on my G2 I get a crazy layout. Thanks for this heads-up. I will report later on the changes I had to make.
m.

Categories

Resources