So. Suppose we have a certain array in which objects of different types are stored. It is necessary, depending on the type of object, to display a certain picture. I have an idea that you need to rewrite the adapter, but maybe there are some other solutions to this issue?

  • 2
    besides own adapter there are no solutions to this question. The developers did not think that you might need this and did not include such an adapter in the API, you bastards :) - pavlofff

1 answer 1

As the speaker said above - you definitely need to write your adapter, there is no ready-made implementation for such a task (except in the most distant and dark places of GitHub).

However, the approach with the definition of an object (if you want to do this through instanceof ) is not correct. In your case, it is better to make sure that all your objects implement a specific interface and say that you need to display.