Android 如何将列表放入数组
如何放置字符串列表,键入string 在 a是包含列表的变量 因此,它将是Android 如何将列表放入数组,android,arrays,sorting,listview,arraylist,Android,Arrays,Sorting,Listview,Arraylist,如何放置字符串列表,键入string 在 a是包含列表的变量 因此,它将是 String countryList[] = {"heyyesGabon","heyyesGibraltar","heyyesGuinea"}; //and the others 此列表来自javascript中的console.log 它总是将最后一项从列表保存到字符串数组 String [] countryArray = countryList.toArray(new String[0]); 从字符串数组到
String countryList[] = {"heyyesGabon","heyyesGibraltar","heyyesGuinea"}; //and the others
此列表来自javascript中的console.log
它总是将最后一项从列表保存到字符串数组
String [] countryArray = countryList.toArray(new String[0]);
从字符串数组到列表
List<String> list = Arrays.asList(array);
List List=Arrays.asList(array);
您可以使用内置函数list.toArray(stringArray)代码>它将返回字符串[]
String countryList[] = new String[list.size()];
countryList = list.toArray(countryList);
希望这对您有所帮助。只需使用list.toArray()构建list函数即可
String countryList[] = new String[list.size()];
countryList = list.toArray(countryList);