I am trying to show some views based on certain conditions in getView() in Android. This is my code:
@Override
public View getView(int position, View view, ViewGroup parent) {
if (view == null) {
final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if(Type.equals("note"))
{
view = inflater.inflate(R.layout.note, parent, false);
}
else
{
view = inflater.inflate(R.layout.event, parent, false);
}
}
However it is not working since android recycles the last inflated layout and displays it.
Are there any workarounds?