【发布时间】:2013-05-02 12:23:42
【问题描述】:
我有一个数组:
File [] temp=null;
我有一个 arrayList 的 File 类型:
List <File> tempList = new ArrayList <File>();
现在我想将temp 的内容添加到tempList。所以任何人都可以请告诉我我该怎么做?
【问题讨论】:
-
循环遍历
temp数组并将每个文件添加到tempList -
其他人都知道,使用 for 循环将数组内容添加到
ArrayList会在 Android Studio 中向您发出警告,提示您使用ArrayList的addAll()方法。你仍然可以这样做,但由于某种原因 Android Studio 不喜欢它(也许使用该方法更有效?)