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?
1 answer
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.
|