canvas.drawText seems does not work properly in Android api >19 - android

I have an issue that is making me crazy.
I created an Android library for a Custom gauge view of a car applicaction.
On this gauge view there's a scale with values drawn with function Canvas.drawText().
Everything was working fine when running whis view on devices with API 19 and 22, up to when last week I updated Android Studio 2.2.
Since that time the values on the scale are not properly written if I run it on a device with API >19. If I run it on device with API =< 19 everything is fine.
This is the test project that can be cloned from Github:
https://github.com/dequadelisonz/CarDashDemo.git
This is what I should correctly see (on device with API <=19):
And this is what I see on device with API >19:
As you can see in the 2 gauges there are only few digits in one of the two. All the other texts seems to be disappeared.
Hope someone can do the trick to fix this thing....
Thanks!

Fixed thanks to this post
https://stackoverflow.com/a/14989037/746068
It seems there is a bug on Android APIs > 15 so that text is not properly drawn on canvas.

Related

Why my app crash on some devices and change layout while in other devices even with diffrent sizes it work perfectly

Hi im new to android dev i started from 1 months ago
Well i created simple calculating application
I configured layout so it looks stable and in preview in some screen sizes it was as i expected
When i run the app it workks perfectly ln some devices i tried android 11 5 and 7
But in some other devices android 10,9,8,5 some buttons get bigger... and when i click a button to show an alerte dialog it crasheess
Well in other devices the alerte dialog show and the app works perfectly without any problem please help
well the problem is that you wrote your program for android 11 and that is why it is shown and performs differently in older versions of android if you wish to make it work the same on all devices then you should choose an older SDK version preferably one that is compatible with version 5; But if you do so you might not be able to use some of the new libraries or packages that you used for android 11.
Make sure the version you are applying on other devices is supported. If you are still experiencing crashing, please share the error code with us.

How to solve massive rendering problems in Android development

I'm currently working with Xamarin for developing an android app. The structure of the app is really simple yet but a big problem appeared concerning the rendering of my main page. First, it's important to know that I'm supposed to develop for target API 23 so Android 6.0.
And every time I test my application on my Android 6.0 device via USB-debugging the design is totally messed up with my only (!) button duplicated many times and the textViews mixed up over the screen (As shown in the picture link below).
Even though I am new to Xamarin and Android (and C#) I have my settings (as I think) in perfect order. The minimum API level is 21, the target SDK version 23 (Android 6.0), my device runs version 6.0.1, the target compiling framework in properties is set to 6.0, the manifest is set up as I mentioned before and even my "Designer" window with the layouts .axml is set to v23.
I really don't know what to try next, because I want to start coding further. Would be nice if sb could help me out with that.
I have already tested the code of the app on a different API level (26 I think) and it worked perfectly fine with my Galaxy S9 in Debugger mode. Everything looked like it was designed in first place.
I also tried different AppThemes in Visual Studio but not one of the 7-8 I tried worked in any way different except for the colors.
The android app does only switch when clicking the button, texthttps://imgur.com/i0xChVniew 2 into the current date and time. I'm really sure, that my code is not the problem.
Picture: How it should look (In Xamarin)
Picture: How it looks on the phone

view.invalidate not working on phone

I have a Custom view, made up of several view and label components. When the user touches the view, I draw a frame around the view to indicate selected status, and the background changes on double tap. The frame is drawn using the overridden draw function of the view by passing the view a frame color different from the background and calling view.invalidate(). Same for the background change.
This used to work perfectly as long as I was developing for API 7. Even on my phone that runs API 16. I recently migrated the code to API 11+ and now the selected frame is not showing anymore and the background does not change on my phone even though it is still working in the emulator (API 14).
A afternoon of trying to trace where the error is, I figured out that on my phone, calling view.invalidate() is not triggering a redraw of the view. I also tried view.requestLayout() and view.postInvalidate() (just to make sure) with the same result. Putting the invalidate command in a separate thread did not work either.
To summarize:
Code API 7 - Phone API 16 - Emulator API 7 to 14 view.invalidate works
Code API 11 - Phone API 16 - Emulator API 11 to 14 view.invalidate does not work on Phone but on emulator.
I have a Motorola RAZR M from Verizon
Is this a known bug or was there a change in handling of things like that in API 11?
Any help is appreciated.

legend not working in afreechart in tablet android

I am using Afreechart to create charts for my android app. In emulator legend is visible but in android tablet legend is not showing up. Previously it was working properly but when i add some other activities to my app,its not working. am using afreechart-0.0.4.jar.my minSdkversion 3 and target is 15.
I found the solution for my question..
The thing that pointed me in the right direction was the fact that the graphs would behave perfectly on the emulator, independently from what version of Android the emulator was running. That made me think that maybe the hardware acceleration (which if I am not mistaken was introduced with HoneyComb) had something to do with this. A little more googling showed me that other graphics libraries had similar issues on ICS and JellyBean, so I tried switching off the hardware acceleration for the chart view:
chartView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Now the graphs and the legends show up just as expected on any device. Hope it helps someone....

Android AVD- modifying API level, changing the APP view

Hi I was using Google API level 7 for my App.
I coded all layouts in dip unit. Now I installed Google API 8, changed my project to use level 8.
But, after launching the App, getting modified view. For e.g- the length increased for a list-view. Also, service call is not working. Restarting eclipse didn't solve the issue.
Then again switched back to Google API 7, now the service calls working fine. But, having layout issues like- font-size got bigger and list-view having increased height.
so, is there anything am missing? or why the layout is changing in different API Level! I don't have a device; will all the element measurements change in device?
which layout are you use? if linear layout then no problem because when you check it on device it will get in proper manner.now you got problem of size of emulator so click on avd > click on avd item(Google api 8) > click edit button > set built in : HVGA >edit AVD > then run
dont worry check it in device it will get properly.

Categories

Resources