Good day!

In the Andorid Studio in the drawable folder are photos, for convenience, I shoved them into arrays. It is necessary to bring data from the array to Scroling activity. How can I do that?

int[] Arr1 = {R.drawable.S_1,R.drawable.S_2,R.drawable.S_3,R.drawable.S_4}; int[] Arr2 = {R.drawable.S_21,R.drawable.S_12,R.drawable.S_13,R.drawable.S_14}; 

    1 answer 1

    1. Run through the array.
    2. In each iteration, add an ImageView to the only ScrollView child and assign it a picture.
    3. After completing the loop and calling the onResume method OutOfMemoryError get an OutOfMemoryError
    4. Realize that a lot of pictures in ScrollView eat up all the memory.
    5. Understand that the pictures should be displayed in the list.
    6. Try to do it through outdated ListView
    7. Have lots of problems with it.
    8. Reinvent yourself and rewrite everything under RecyclerView
    9. ???
    10. Profit!