Why Is Volley Returning Null Value For Response Object
Here is my onResponse method public void onResponse(SongInfo response) { Log.v('TAG', 'Response value is '+String.valueOf(response.artworkUrl30)); // Prints 'Response valu
Solution 1:
I don't think you can just map the Json
response as if it's completely flat, and all fields are located at the root of the Json
hierarchy.
Your SongInfo
model should probably look like this:
publicclassSongInfo {
publicint resultCount;
public List<Results> results;
}
And you'll need a Results object, something like:
publicclassResults{
publicString wrapperType;
publicString kind;
.
.
.
publicString artworkUrl30;
}
Solution 2:
If you are expecting an JsonObject as Response use Volley JsonObjectRequest,else JsonArray as response, you have to make Volley JsonArrayRequest.
After getting the response make the Gson to handle the response data with SongInfo class.
If you are thinking to use other Library for Network call, I suggest you this, enter link description here
Post a Comment for "Why Is Volley Returning Null Value For Response Object"