What's the correct way to implement key-value pair in Spinner in android

后端 未结 4 1725
無奈伤痛
無奈伤痛 2020-12-04 14:15

Is this the correct way to implement key-value pair for a Spinner in Android?

package com.mypackage

import android.app.Activity;
import android.os.Bundle;
i         


        
4条回答
  •  萌比男神i
    2020-12-04 14:52

    this is one way. i use it quite a lot though i use my own adapter (inheriting from BaseAdpater). Another way would b like the above to have an index (0,1,2 etc ) mappd to a value and when you get an item get it's index a well so you can retrieve it's value fro mthe map. I like that option less...

提交回复
热议问题