Android: ¿Qué formato de imagen debo usar y por qué? [cerrado]

Im a beginner programmer, and my question is: Which image format shall i use for my android app?

Descripton: I only use illustrations, so the images are mostly background images, and some buttons, and i would like to know which is the best way to do this.

My current progress for images are the next: I use .png file format. I dont know what resolution should I use, now I work with 300x400 px images aproximetly.

Here is my code for using the images:

Bitmap bMap = BitmapFactory.decodeResource(getResources(), MyArray[index].getArtiD());


So this is the way I use images in Android, pls guys if anyone know issues, tips or a "must know information" to tell pls do it. I dont really understand why should I use this bitmap factory or why should i use png format. I want to do it in the best way I can, and I dont see many things in android documentation.

Gracias, adam

preguntado el 08 de noviembre de 11 a las 08:11

2 Respuestas

In android the best format of Image is PNG as it light compare to JPG,JPEG etc.So its easy to draw and take less time to perform the operation while using these images.

And For bitmap Go through this Bitmap Help

Editado Yes no need to use Bitmap ,if you have images in resource.If your images are in Drawable then use

ImageView img=new ImageView(this);
//You can use like that without using Bitmap

Respondido 08 Jul 19, 22:07

Why should i use Bitmap factory then? ...if png is good enough? - Adam Varhegyi

You can use PNG image Only from drawable folder (Directly if present).But Bitmap can decode a stream of image, it can fetch image from resource also. - Tofeeq Ahmad

Note that: "img.setImageResource(...)" still calls the bitmap routines, potentially on UI thread:

That may cause undesirable UI-lags, so you might want to deal with the BitmapFactory yourself, in a seperate thread, as discussed here:

As to the original question, PNG comes is many forms (see: 'PNG color options' and 'PNG color types' on the PNG Wiki page) -- Is there a favoured PNG format for Android?

Respondido el 06 de diciembre de 14 a las 14:12

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.