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

后端 未结 4 1733
無奈伤痛
無奈伤痛 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条回答
  •  执念已碎
    2020-12-04 14:57

    Create a map of key-values, and take a value in onItemSelected(you can obtain "key" via spinner.getAdapter().getItem(position)).

提交回复
热议问题