如何使用“ Curl stArr”无法显示该值。我不知道循环字符串数组使用什么问题。

    mainListView = (ListView) findViewById( R.id.listView100 );


     SharedPreferences prefs = getSharedPreferences("MY_FAVOURITES", MODE_PRIVATE);
String    test_string = prefs.getString("name", "");

  persons = test_string.split("DDDDDDDDDD");

 int  t = persons.length;

  if(t<0)

  {
      Toast.makeText(getApplicationContext(),"xtronlabs", Toast.LENGTH_SHORT).show();
  }
  else

  {
      for (int i = 0; i < persons.length; i++)
      {
      String currlst = persons[i];
    currlstArr = currlst.split("LLLLLLLLLL");

    caption = currlstArr[0];

     vlink = currlstArr[1];


      }


    mainListView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,currlstArr ));

  }

如何在列表视图上使用字符串值我不知道我的错误。

最佳答案

您缺少声明“ currlstArr”的部分。您正在foreach中设置currlstArr的值,因此,如果t

currlstArr = new String[] { "Android", "iPhone", "WindowsMobile",
        "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
        "Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux",
        "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2",
        "Android", "iPhone", "WindowsMobile" };

10-01 06:41