BitmapFactory functionality

1

I've been browsing the API of android for a while trying to understand the function of BitmapFactory .

At what times am I supposed to use BitmapFactory , and why?

    
asked by Ramosaurio 12.08.2016 в 17:22
source

1 answer

1

The BitmapFactory class creates bitmap objects to from different sources that can be files, streams, or byte-arrays . Its use is suggested when loading images from the sdcard or disk.

An example, create a bitmap object from an image stored in the sdcard and which we add to an ImageView:

ImageView imageView = (ImageView) findViewById(R.id.mi_imagen);
//Convierte a mapa de bits
Bitmap bitMap = BitmapFactory.decodeFile("/sdcard/mi_imagen.png");
//Carga imagen en imageView obtenida a partir de un recurso.
imageView.setImageBitmap(bitMap);
    
answered by 12.08.2016 / 21:03
source