本文介绍了在Android微调器数据库中填充数据,并检索所选项目的文本和值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个微调器,我需要在sqlite数据库中填充微调器数据。我在获取在spinner.v中选择的项目的选定值和文本时遇到问题。这可能吗?另外,如何将数据填充到微调器?

I have a spinner, in which I need to populate the spinner data from sqlite database. I am facing a problem in getting the selected value and text of the item that is selected in the spinner.vHow is this possible ? Also, how to populate data to spinner ?

推荐答案

String[] array;  //Use must initialize

Spinner spinner = (Spinner) findViewById(R.id.spinner1);

ArrayAdapter arrayAdapter =  new ArrayAdapter(this,android.R.layout.simple_spinner_item, array);

spinner.setAdapter(arrayAdapter);


这篇关于在Android微调器数据库中填充数据,并检索所选项目的文本和值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 01:12