How to store images in an Android vector?

0

I have images inside drawable and to access it, R.drawable.myimage is sufficient. How do I store these images in vetor ?

    
asked by anonymous 21.02.2016 / 16:54

1 answer

2

Do not save the images, save your resource Id using a int[] :

int[] imagensIds = {
    R.drawable.image1,
    R.drawable.image2,
    R.drawable.image3
};

You can pass all images to a method:

processaImagens(imagensIds);  

or just one:

processaImagem(imagensIds[1]);

Declare the methods as follows:

private processaImagens(int[] imagensIds){
}

private processaImagem(int imagemId){
}
    
21.02.2016 / 17:36