Only refresh and refill correctly if user top of the layout
mustafaerturk opened this issue · 1 comments
that's my problem I posted stackoverflow one days ago.
http://stackoverflow.com/questions/19326959/staggeredgridview-refresh-correctly-only-top
today ı make a some modifaication on your demo app and try it.
Firstly ı add a slidingMenu and two button inside sliding menu. one of set empty array to adapter thus ı remove all items
close LoadmoreListener
ptrstgv.setOnLoadmoreListener(new StaggeredGridView.OnLoadmoreListener() {
public void onLoadmore() {
// new LoadMoreTask().execute();
}
});
add this code part inside STGVadapter for set another array
public void getMoreItem2() {
mItems.clear();
Item item = new Item();
item.url = mData.url[1];
item.width = mData.width[1];
item.height = mData.height[1];
mItems.add(0, item);
this.notifyDataSetChanged();
}
And inside onPostExecute() add this part
if (buttonClick == false) {
mAdapter.getMoreItem();
mAdapter.notifyDataSetChanged();
} else {
mAdapter.getMoreItem2();
mAdapter.notifyDataSetChanged();
}
if button click call getMoreItem2() and set empty array.
Finally
button = (Button) findViewById(R.id.button_Deneme);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
buttonClick = true;
new LoadMoreTask().execute();
Toast.makeText(getApplicationContext(), "click",
Toast.LENGTH_LONG).show();
}
});
The same issue if user top of the layout it works and set empty array, clear all items. But İf user bottom of the layout nothing happend.
How can ı fix this ?
I have the same issue while doing multi-select in custom adapter.
On item select, if user is at top of grid, items become selected properly.
But if scrolled anywhere else but absolute top of grid the items do not change state, though the adapter does select them.
If user scrolls back up to top and selects an item grid shows correct selections again.