将数组字符串显示到android中的listview?

时间:2014-10-29 09:06:43

标签: java android listview

            String output_ktdk="";
            String outputjson = result.replace("[", "").replace("]", "");

            listView = (ListView) findViewById(R.id.listView1);


            String[] values = new String[] {
                    outputjson

                };
            final ArrayList<String> list = new ArrayList<String>();
            for (int i = 0; i < values.length; ++i) {
              list.add(values[i]);
            }
              ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.this,
                      android.R.layout.simple_list_item_1, android.R.id.text1, list);
              listView.setAdapter(adapter); 

  • 显示列表视图:&#34; abc&#34;,&#34; abc&#34;,&#34; abc&#34; .....

  • 帮助我..............

cxcxccx

1 个答案:

答案 0 :(得分:0)

首先应该使用JSONObject

解析outputjson