I found a solution myself. This is fairly easy to understand and implement and requires only JSON knowledge. First, see this image from the directory of my website:

"event1", "event2" are the names of the albums. We can create so many necessary.
" getfolders is very important. Content:
{ "test":[ { "sub":"event1", "content":"https://i1.wp.com/www.downloadinformer.com/wp-content/uploads/2017/03/AMPFB.jpg?w=1366", "param":"1.php" }, { "sub":"event2", "content":"myimageurl", "param":"myphpfilenamewithextension" } ] }
Here we record the names of the albums, as you can see in the "sub" field. The "content" field contains a link to the album thumbnail, and "param" contains the name of the corresponding PHP file. Do not worry, you do not need to learn PHP. This is a finished script.
1.php
<?php $indir = array_filter(scandir('event1'), function($item) { return $item[0] !== '.'; }); echo json_encode($indir); ?>
What does this PHP file do? It lists all the file names present in the specified folder. As you can see, we specified " event1 " as the name of the folder in this PHP file. Thus, it will return all image names in JSON format. Do not forget to specify this PHP file in the "param" field of the "getfolders" file.
Good. So it was a kind of algorithm. If you have any confusion, reread it again. Now I will show the code.
I did two actions (did not prefer fragments). One to show albums, and the second to show the images present in it.
Operation 1 - > Scabs getfolders and retrieves the albums that we specified earlier.
Album name: sub field of the above JSON, Thumbnail album: content specified above JSON, (Hidden from the user) Image name list: param field
So we can show it in Recyclerview with this information. Now we specify the OnClickListener for our elements.
When you click β Start the second action with Intent and transfer the album name, which is essentially the name of the folder on our server. Thus, we gain access to the folder containing the images. Also pass the value of the param field. This gives us the URL "www.mywebsite.com/..../alreadyspecifieddirectory/1.php"
Activity-> 2 Implement GridLayoutManager to show photos to the user. Retrieve previously passed values ββusing getIntent() . First we need to execute this PHP file and parse the contents of the JSON. Here is the code:
private void loadJSON(){ StringRequest stringRequest = new StringRequest(Request.Method.GET, URL_DATA, new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); for (int i=2; i<jsonObject.length()+2;i++){ String value =jsonObject.getString(String.valueOf(i)); if (value.length()!=0) { ListItem item = new ListItem(value, mParam1+"/"+value, "nothing"); listItems.add(item); } } adapter = new PhotoLibraryAdapter(Photos.this,listItems,photosList,true); photosList.setAdapter(adapter); progressBar.setVisibility(View.GONE); } catch (Exception e) {progressBar.setVisibility(View.GONE);} } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { progressBar.setVisibility(View.GONE); } }); RequestQueue requestQueue = Volley.newRequestQueue(this); requestQueue.add(stringRequest); }
Please note that we started the cycle from 2 because the PHP file returns the values ββfrom index 2, because the value 0 and value 1 are waste values ββand are called ".". and correspondingly.
Therefore, we get the names of the images that we can pass from the URL: "www.mywebsite.com/.../albumnameretrievedearlier/imagenamegivenbyPHPfile"
and transfer it to the adapter so that we can upload images using the Picasso library.
What is it! If you have any questions, feel free to ask in the comments.
EDIT 1: Here's what it looks like:

