Android - How to get position in bindView like in getView?

villager picture villager · Jan 28, 2013 · Viewed 14.8k times · Source

In getView() of CursorAdapter, there's a parameter position so I can do a checking for that position, how can I do the same on bindView() it has no position parameter in BindView.

Currently I'm overriding newView(), bindView() and getView() which I read and heard is bad, either override getView() OR newView() and getView().

Thanks.

Answer

subair_a picture subair_a · Jan 28, 2013

Try this

public void bindView(View arg0, Context arg1, Cursor arg2)
{
    int pos = arg2.getPosition();
}