需要没有{}大括号控制的大括号的值

时间:2015-03-26 00:56:54

标签: android

我有spinner控件,我添加了字符串数组,所以我得到了微调器中的所有项目,当我将所选项目打印到toast中时,也打印出字符串数组名称=项目之间的{}括号 我只获得要在sqlite中插入的项目名称

String[] question = {"How are you?","Where are you?","Who are you?"};
spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> arg0, View arg1,
                    int arg2, long arg3) {
                // TODO Auto-generated method stub
                String str = arg0.getItemAtPosition(arg2).toString();
                Toast.makeText(getApplicationContext(), "ans: "+str, Toast.LENGTH_LONG).show();

        }
}

1 个答案:

答案 0 :(得分:1)

使用String.split(“=”)拆分toString()结果。