Open sdobek opened 10 years ago
Thanks Steven, should be interesting to see if there's a simple fix, I will definitely take a look. Thanks for catching this issue! Let me know if you find anything.
@sdobek Can you replace your endless scroll listener with this updated code block? and verify that it fixes the issue? Thanks!
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