Android Animation Performance - android

If I use a gif image instead of an xml file (< animation-list>), would I save processing to display an animation?
I have to build an application where the battery consumption is critical. So I have to search multiple issues like this.
Where can I find information related to this?

If you are talking about Animated GIF images these are not fully supported on Android.
Here is a link to a discussion about them (both native and browser display)
http://code.google.com/p/android/issues/detail?id=3422
In my testing the most efficient (CPU and battery) animations are stored in XML because they can be compiled and avoid on-demand parsing or other processing that would be required for a GIF or frame animation with drawables.

Related

How to reduce Android app size by compressing images?

I am developing an Android app which has hundreds of .jpg files (over 300) each one of around 40kB. I would like to know if there is a way of reducing the size of my app. I looked at a similar question here Reducing Android App Size, but the problem still exists. Is there perhaps a way to compress the images and decompress them in real time when needed, or any other way to make my app more space efficient while not sacrificing speed?
If you have used tinypng for every resource you did your best with this kind of solution. In general, it's better to use vector graphics where the general icon will be <1kb. Also, a vector resource can be animated. If it's quite simply bitmaps, you can generate them in code on demand. Also, you can divide your app by dynamic features and each will be downloaded on demand with their part of the resources.
Is there perhaps a way to compress the images and decompress them in real-time when needed?
There is no standard Android solution out of the box. Probably, you can write something on your own. But this looks like too much effort.
Still, the most practical solution: use vector graphics as max as possible, generate in code what you can generate, compress with tinypng the others. That should be enough or you should have a very good reason for making some extra work.
For more info about vector graphics in android. For standard vector graphic import right in the android studio.
Web-site where you can download icons and insert them into the project.

Can Android handle computations in image processing and ttf rendering?

I am planning to create an Android application that will enable users to draw their own font. One similar app I found, they render the drawings online and sends the ttf file via email. What I want in my study is to render offline and saves the ttf directly into the sd card. Do you think Android can possibly do it? I am worried if it can handle all the computations of the first step which is image processing and handle those parameter requirement in rendering into .ttf (TrueType) format.
There's no reason why it wouldn't be able to.
If you can't find a API function that can do this, you can always write a small native library (using NDK), and use the FreeType open source library to do the rendering.
If you need an example of character rendering to OpenCV images, look in this short code:
https://github.com/amirgeva/optmatch/blob/master/src/chrmatch/ftfont.cpp

Using SVG files in android and memory usage

My application has an activity with metro schema, so for good quality I need to put image with resolution more then 2000x2000, but such images use much memory and application crashes with Out of memory error.
Does this problem will solve when I will change the image source to SVG (by svg-android for example)?
It depends on the complexity of image simple vector re presentable image will defiantly improve the performance otherwise complex images will use more memory.
more Details here.

Facebook's FriendPickerFragment on Android seems very slow

Has anyone else encountered problems with the performance of the FriendPickerFragment from Facebook? I'm following the tutorial for showing friends ( https://developers.facebook.com/docs/tutorials/androidsdk/3.0/scrumptious/show-friends/ ), but it takes minutes to scroll down a list of less than 300 friends.
Since no one else has posted this concern, I'm inclined to think I'm doing something wrong. Does anyone have any suggestions on how to get it to perform as well as the "native" friend list in Facebook's Android app?
Your guidance is greatly appreciated!
-Tim
You can try use Universal image loader.
This is for listView optimization and improving performance if your listView contain images from web.
Features:
Multithread image loading Possibility of wide tuning ImageLoader's
configuration (thread executors, downlaoder, decoder, memory and disc
cache, display image options, and others) Possibility of image
caching in memory and/or on device's file sysytem (or SD card)
Possibility to "listen" loading process Possibility to customize
every display image call with separated options Widget support

Open CV Vs NDK for Image processing

I am writing a program to manipulate images,ie change its color,brightness,contrast etc...
The DVM doesn't support the manipulation of images of size beyond a limit...Can any one tell me whether using Open CV will solve the issue(as this seems to be a better option than NDK)?
Or will I have to use NDK?
I have done a lot of search and was not able to find answer..
First of all, there are different options for Image processing in Android, see here for a comparison of the most popular options: see Android Computer Vision JavaCV OpenCV FastCV comparison and Image processing library for Android and Java
Coming back to your question: If the images you deal are really very large so that they do not fit into the memory of the device, you need to process the images in small chunks called tiles.
If your images are not that big, I recommend you to use OpenCv, if you have to do anything more than very simple tasks such as brightness/contrast adjustment.

Categories

Resources