Refreshing Single Cell in Base Adapter in android

Go To StackoverFlow.com

1

I want to get the function that only refreshes one cell of GridView Currently I am using baseAdapter.notifyDataSetChanged() which refreshes whole grid , and I have to do this even I have only cell having different data How can I do it

2012-04-05 15:14
by Raheel
can't you just call the adapter's getView method directly - dldnh 2012-04-05 15:54
Yes I tried this, but this do not update data on the scree - Raheel 2012-04-05 17:18


0

We can't refresh single cell, but to achieve this effect we can get position of first cell displayed in the screen (not the first cell of the grid), then simply save that position ,refresh whole grid and preview from that saved position

            int prevcurr = gridview.getFirstVisiblePosition();
            Adap.notifyDataSetChanged();
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            gridview.requestFocusFromTouch();
            gridview.setSelection(prevcurr);
2012-10-22 05:04
by Raheel


0

Before apply your changment in the cell. After use this code (for me is about the gridview)

    adapterForImage.notifyDataSetChanged();
    gridview.setAdapter(adapterForImage);
2012-07-20 06:55
by Boris Karloff
what is adapterForImage - Raheel 2012-07-20 11:10
CustomAdapter adapterForImage;

It is a class for to adapt (in my case) a layout N times in the gridview - Boris Karloff 2013-06-24 00:57

Ads