I want to list 70 albums, each one having album information(name, image, description).
In the Java class Im getting that 70 albums with the method getAlbums qm1.getAlbums
. The result of this operation is on this format (first the names then the ids of the albums):
[[‘Achtung Baby’, …, ‘Pop’], [100, .., 160]]
(achthunb baby has the id 100, and the Pop album has the id 160)
This part is working fine.
Now in the Java class is caled other method “qm.getAlbumInfo(name, id)
” where I want for each returned album above return the information(name, image, description).
Error: But its not working properly it shows always the information of the first album three 3 times. So its not showing all the 70 albums, just shows 3 albums and all 3 albums that appear are the same.
Do you know where is the error?
Java class:
QueryManager qm1 = new QueryManager();
// qm1.getAlbums returns on this format
// [[‘Achtung Baby’, …, ‘Pop’], [100, .., 160]]
ArrayList<ArrayList<String>> result1 = qm1.getAlbums();
qm1.closeConnections();
String name = result1.get(0).toString();
String id = result1.get(1).toString();
QueryManager qm = new QueryManager();
ArrayList<ArrayList<String>> result;
// the error maybe is in this part:
for (int i = 0; i<= result1.size(); i++)
result = qm.getAlbumInfo(name[i], id[i]);
qm.closeConnections();
ArrayList<String> albumInfo = result.get(0);
System.out.println(albumInfo.size() + "albumInfo SIZE"); // shows 3
System.out.println(result1.size() + "result1 SIZE"); // shows 2
System.out.println(name.size() + "name SIZE"); // shows 70
System.out.println(id.size() + "id SIZE"); // shows 70