I have this snippet below:
            public void onReceive(Context context, Intent intent) {
                    try {
                        int random_int = (int)Math.floor(Math.random() * (max - min + 1) + min);
                        if(random_int == 0){
                            wallpaperManager.setResource(R.drawable.phonewallpaper1, WallpaperManager.FLAG_LOCK);
                        }else if(random_int == 1){
                            wallpaperManager.setResource(R.drawable.phonewallpaper2, WallpaperManager.FLAG_LOCK);
                        }else if(random_int == 2){
                            wallpaperManager.setResource(R.drawable.phonewallpaper3, WallpaperManager.FLAG_LOCK);
                        }else if(random_int == 3){
                            wallpaperManager.setResource(R.drawable.phonewallpaper4, WallpaperManager.FLAG_LOCK);
                        }
                        // set the wallpaper by calling the setResource function and
                        // passing the drawable file
                    } catch (IOException e) {
                        // here the errors can be logged instead of printStackTrace
                        e.printStackTrace();
                    }
This code is basically set randomly the screenlock wallpaper based on the static images (4 images) in drawable folder. If I put 4 new images in a folder of android device, for example under "/storage/emulated/0/downloads/contents/".
How can you change the images dynamically in drawable folder based on images under "/storage/emulated/0/downloads/contents/"?
Is it easier just to replace programmatically the images in drawable folder, or just point the code to the folder "/storage/emulated/0/downloads/contents/" instead?
I have google around how to do this but cannot really find anything that set the screenlock wallpaper from a device folder.
Thank you
                        
And
image1.canRead()is not readable