Skip to content Skip to sidebar Skip to footer

Load More - Only The Original Thread That Created A View Hierarchy Can Touch Its Views

My app is using GridView to get image from JSON. Everything is ok but now I want to make it for loading more by clicking on button. I followed this tutorial Android ListView with L

Solution 1:

You should probably move this code:

intcurrentPosition= gridView1.getFirstVisiblePosition();
                ImageAdapteradapter=newImageAdapter(CardActivity.this, MyArrList);
                gridView1.setAdapter(adapter);
                gridView1.setSelection(currentPosition + 1);

into the onPostExecute method, because it has to be run on UI thread

Post a Comment for "Load More - Only The Original Thread That Created A View Hierarchy Can Touch Its Views"