Android smooth image animation - android

I am working on image animation. I have 200 transparent png images which I am trying to show one by one over a background image.
Can you tell me the best way to do it. The image should change in such a way that it should appear that a cartoon is running.
If you can tell me in steps, it will be great.

Have a look at animation frames: http://developer.android.com/guide/topics/resources/animation-resource.html#Frame

You can use animation-list to play them frame by frame
http://app-solut.com/blog/2011/05/playing-animations-in-android/
or create a GIF and play it
http://droid-blog.net/2011/10/14/tutorial-how-to-use-animated-gifs-in-android-part-1/
Gif is more lightweigt, but it gave me trouble once when played on some MDPI screen devices, where I had a single Gif file in the drawable-hdpi folder. So give it a try first..

Related

How to make glow effect in image view for a small part

I want to make a small part of the image glow whenever the activity is loaded. Do I need to take the exact coordinates of the image part?
I recommend using a GIF. It can be loaded as an image and won't require any changes in your code. A smallish tutorial can be found in this Youtube video.

Why would android forget some assets?

My Problem: Only one image will actually load from the assets folder. I have all the images there and when I try to access any of them I don't get an error. By actually load I mean it shows the image on the screen. When I load the other images the whole screen comes up white.
In every instance I am loading the whole image to the whole screen.
If I were to put the image as a fourth its size in the middle of the screen then there is a white rectangle there. The image is supposedly in the .apk because I don't get an error for the game trying to find it. However if I were to load this one image then everything words fine.
The one image that works find is a .png image and I tried to load the others as a .png but it does not work.
Any advice on where to start?
I load the images through the AssetManager.readAsset() as an input stream and then use the bitmap factory to get the image as a bitmap. Afterwards I load the bitmap into open gl and draw the region I want. However, the problem is only my first image I ever started using works at the moment. Could there be something wrong with a file that eclipse generates?
Some png bug android.
Just try to open them and save them with gimp. Sometimes it solves the problem.
Finally found the solution.
Turns out that one image that worked had a bit depth of 32 and the other ones only had a 24 bit depth.
The solution is to open up the image in gimp, add an alpha channel (makes it 32 bit), and save it as a .png file. Then read the details and it should say it is 32 bit.
Thanks guy! :)
Also note that images have to be by power of 2. For example it needs to be 1024 by 1024.

How do I load a blurred image first, in imageview, and then make it sharp, in order to enhance user experience, for android?

I'm working on an application in which I need to download lots of images. The images are to be seen in the fullscreen mode. Therefore, I wanted to know how to load an image, speedily, to make the application more responsive and enhance user experience. I would like to, atleast, show a blurred image first and than make it sharp. Thanks.
use BitmapFactory.Options.inSamleSize to load a downsampled version of the image. Then load the bigger image and do a fade transition using a TransitionDrawable
You're looking for "progressive image rendering", which can be done in a variety of different image formats, including png, jpeg, gif, etc. The next time you're going to save an image in a good graphics program, select one of those formats and take a look at your save options. You should have an option to save an "interlaced" image.
Jeff Atwood of Coding Horror has a nice write up here: http://www.codinghorror.com/blog/2005/12/progressive-image-rendering.html

Animated Images in ImageView?

Example Images
Would implementing these into an android app as an ImageView be the same as implementing a regular image, or would problem, low performance occur since they are .GIFs?
I am aware that .PNGs are the go to image for android so is it possible to create animated .PNG images, if not what is the best practice for including animated images?
First, PNG's can't be animated. From bitmap formats, only GIF supports animation. Unfortunately Android doesn't support animated gifs.
Read also this: Display Animated GIF
You may use AnimationDrawable to display animated set of images. However, such storing of animation frame by frame is taking much more memory than typical animated gif.
There's no easy solution for displaying animated gif on Android at present.

How display a loading image correctly on Android phone

I have been trying to use a .gif file from my resources, but I get no movement when it loads. I am using it as a loading image while I am doing an asynchronous task. I was previously using a progress dialog but now I would like to display the image myself and not use a dialog. How can I get this image to display correctly?
Try using AnimationDrawable:
http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html
Basically, you should split each of the frames in your gif into separate files - such as .png file (say if it had transparency) and specify these files in the <animation-list> instead. You can also control the duration of each frame.
See the link for code example
If you are deadset on using a gif image you can just use a WebView instead of an ImageView. Then make an html doc that displays your gif image. When you show it in the WebView it will be animated for you.

Categories

Resources