java - How do you call on/use files from outside the activity class in Android Studio? -


i create array of images drawable folder in class outside app activity class in android studio. can use getresources() method in activity. keep code clean , organized , creating array in activity may messy if accumulate more images. there similar or way access getresources() method outside class? trying generate randomized background using images in drawable folder. open suggestions new developer , may approaching problem incorrectly.

you not need activity per se hold of resources. activity extends context; context gives access resources. need class takes context if want reference of resources.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -