How to make animations smoother in low refresh rate display android device? - android

this question is a general question.I just wanted to know if there is any way through.I am having a very low refresh rate display android device due to which all the animations are getting lagged.I am needing a scaling animation which shrinks and grows of which i am having code but the issue is the smoothness.Is there any possible way that i can make my animation smoother for scaling animation or any way which shows like the animation appears smoother?>
Thanks in advance.

I have faced a similar issue with abrupt animations. Actually, the problem is not with the refresh rate of the device, the application might not be using the full hardware capabilities of the Android device, so not much can really be done
Also add the following line in the application tag of the manifest android:hardwareAccelerated="true" to ensure HW acceleration is used

Related

Ripple effect on all clickable items is slow

I do not know what could it be, but does not look like a performance issue (like doing too much work on the background) because there is no message on LogCat saying Slow measurement, Frames skipped or ConstraintLayout issues. The app animations work perfectly. But, unfortunately, all the clickable elements that I added on the xml:
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
are too slow. That slow, that whenever I click, instead of the smooth animation that moves and starts on the exact pixel I click on, it appears an awful shadow and remains like so for a while (~2 sec).
If it is indeed an android performance issue, how to debug it? Also, I do not know where to start and which information I need to add in order to add valuable information to this question but, if needed, please, ask for it and I will try to add as much information as possible.
The only thing I could say in advance is I am using MVVM and coroutines, so there is no performance issues on that matter, but maybe only UI related?
EDIT:
Samsung J2 Prime and Samsung Galaxy Note 3 work good, all animations are good (even though is a small and old device)
Motorola Zoom and Redmi Note 8 Pro are working with laggy animations (animations are meant only the clickable animation (Ripple effect), the ConstraintLayout animations are working smooth.

What's the better way for a complex animation in android?

I'm trying to insert an animation in my app and I found two alternatives:
the first one is to use the "Drawable Animation" with the "animation-list", but my animation is made of 125 full screen frames and when I tried to start it the app crashed with the "java.lang.OutOfMemoryError".
I tried to fix the problem increasing the heap size by setting the android:largeheap="true" but didn't work.
Is a possible solution converting the images from jpg to png?
I found the solution here java.lang.OutOfMemoryError occur on the animation Loading? and something here Causing OutOfMemoryError in Frame by Frame Animation in Android, but I didn't find a correct solution.
The second way is to create the animation in javascript/html5 and putting it in a webview, but I don't know if this would be a good solution for the majority of android devices and I don't know if it is possible create a communication bridge between the webview and the app.
I found this http://developer.android.com/guide/webapps/webview.html#BindingJavaScript but I'm not sure if it will work.
So could you please give some idea on finding a way for complex animation in android?

LibGDX game lags when touch

I use LibGDX for rendering a game. I discovered a strange issue on Samsung S3. When touching a screen FPS goes down and animation jumps.
On other devices the app works smoothly. Touch callback is very fast and shouldn't affect a performance.
For adding touch support I use
Stage stage = new Stage(new FitViewport(Gdx.graphics.getWidth(),
Gdx.graphics.getHeight()));
Gdx.input.setInputProcessor(stage);
Could you please advice what might be the root of the issue?
Posting the answer in order to help others..
When enabling Show Touches setting in Developer Options be aware that it might decrease FPS of your game. It was my case.

Google Maps slow in Android 2.2's WebView when using CSS3 transformations

I can't get CSS3 transformations and Google Maps to play nice together in Android 2.2's WebView. Here is a fiddle, with two buttons to test transformations. You will need to enable "Emulate touch events" in Chrome to be able to click on them in the desktop. The device I'm using has a 1024x600 screen.
If I don't do anything special, there is flickering when a transformation starts. Now, if I add -webkit-backface-visibility: hidden to the element I'm applying the transformation to, everything is silky smooth and there is no flicker, but the map becomes impossibly slow, and you can't barely scroll around.
I tried to work around this by removing -webkit-backface-visibility by setting it to visible. This works, and the map will be fine again, but setting the property causes flicker. I also played around with -webkit-perspective and -webkit-transform-style, which also seem to get rid of the flicker when a transformation starts, but they also cause flicker when removed.
I also noticed that applying '-webkit-backface-visibility: hidden' to any element on the page makes the flickering at the beginning of transformations disappear. So I put a small div with the property on it, and when the transforms were done, I hid it with "display: none". This causes flicker as well.
My question is, thus: how can I have -webkit-backface-visibility (which I need in order to make the transformations flicker-free) and Google Maps, without making Maps slow?
Possible issues can be 2.2 is rather out of date and you should realistically be using 3.0 now to support tablets. Also, if you are testing on an emulator then this will be your issue.

Manually rotate screen

Hs there any chance to rotate the screen on Android programmatically for the whole system?
Background is that I'm using a CMPC-device which features a non-Android-supported rotation sensor, and as a quick fix, I'm planning to write a small app that changes orientation for the entire system.
Is there any function available for this purpose?
I couldn't find anything on the documentation :(
You can find what you want here :
http://www.anddev.org/rotate_screen_from_code_change_screen_orientation-t2687.html
App can't change orientation for entire system. I guess, you need to make custom build of Android for this purpose.

Categories

Resources