Skip to content

[Android Bootcamp] Steven Dobek - Assignment 2 final page improvement #2

Description

@sdobek

Hey Nathan.
Recall that after class I showed you the problem with the final page of images hitting the exception, which prevented them from being added and prevented the scroll listener from resetting.

We solved it for now with a dummy input:
new JsonHttpResponseHandler(){
public void onSuccess(JSONObject response){
JSONArray imageJsonResults = null;
try {
imageJsonResults = response.getJSONObject(
"responseData").getJSONArray("results");
imageAdapter.addAll(ImageResult
.fromJSONArray(imageJsonResults));
Log.d("DEBUG", imageResults.toString());
} catch (JSONException e) {
//Dummy image added to reset EndlessScrollListener - exception hit on page 9
imageAdapter.add(new ImageResult(new JSONObject()));
e.printStackTrace();
}
}
}

You mentioned improvements could be made.
I plan to look into it tomorrow. Let me know if you find anything yourself.
/cc @nesquena

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions