填充的微调器显示错误的字符

Spinner populated shows wrong characters

感谢您的帮助

我正在尝试使用嵌入式数据库中的数据填充微调器,一切似乎都是正确的:

 public ArrayList<String[]> getCountries()
{
    ArrayList<String[]> array = new ArrayList<>();
    String columnas[] = new String[]{"COUNTRY","COUNTRYCODE"};
    Cursor c = db.query("countryCodT",columnas,null,null,null,null,null);
    if(c.moveToFirst()){
        do{
            String[] obj = new String[2];
            obj[0]=c.getString(0);
            obj[1]=c.getString(1);
            array.add(obj);
        }while(c.moveToNext());
        c.close();
        db.close();
    }
    return array;
}

使用此代码填充微调器:

public void popSpinnerC(){
    BDCountries bdCountries = new BDCountries(this);
    final ArrayList<String[]> dataGot = bdCountries.getCountries();
    ArrayAdapter<String[]> dataAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item,dataGot);
    spnCountry.setAdapter(dataAdapter);
    spnCountry.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            String listId = Integer.toString(i);
            strCounty = listId + dataGot.get(i)[0] + dataGot.get(i)[1];   
            msgData.setText(strCounty);
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });
}

the spinner text shown is wrong, the data amount is correct, when something is selected is shown the right information in a text view with test purposes, how can I correct it? Results:

微调器选项列表是字符串数组列表而不是字符串,因此它打印每个字符串数组的 toString() 作为微调器项。

看看你的getCountries()方法。它返回 ArrayList<String[]> 而不是 ArrayList<String>.