sdobek / GridImageSearch

2 stars 0 forks source link

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

Open sdobek opened 10 years ago

sdobek commented 10 years ago

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

nesquena commented 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.

nesquena commented 10 years ago

@sdobek Can you replace your endless scroll listener with this updated code block? and verify that it fixes the issue? Thanks!