jeudi 4 août 2016

Images repeat in recycler view

I have set of images to display in Recycler View in random way. The issue is that images repeat and not all images are used. What I need is: all images used and display each of them only once (no repeat). Thank you in advance for help.

public class Article {
private int mTitle;

private static int[] sTitles = {
        R.drawable.image1a,
        R.drawable.image2a,
        ....
        R.drawable.image30a
};
public Article() {

   Random random = new Random();

Collections.shuffle(Arrays.asList(sTitles));

 mTitle = sTitles[random.nextInt(sTitles.length)];
}
public int getTitle() {
    return mTitle;

}




Aucun commentaire:

Enregistrer un commentaire