Associate custom identifiers with ListView items

Is it possible to use a hash map in initializing an ArrayAdapter?

hashmap my "regions" handles user ID as keys: Hashmap<ID,Value>.

vRegions.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, regions));

the problem here is what ArrayAdaptermy hashmap will call toString(), which will print valueand drop ID!

I want to be able to use this identifier, is there a way to set it as simple_list_item_1 IDso that I can recover it later inside the onclick event?

+3
source share
2 answers

, hashmap ArrayAdapter, - , - . , , hashmap .

0

ArrayAdapter .

0

Source: https://habr.com/ru/post/1762147/


All Articles