I have an array:
File [] temp=null;
And I have an arrayList of File type:
List <File> tempList = new ArrayList <File>();
Now I want to add the content from temp to tempList. So anyone can please tell me How do I this?
Try this
tempList.addAll(Arrays.asList(temp));
    If you are not going to update the content of the array (add/removing element), it can be as simple as
List<File> tempList = Arrays.asList(temp);
Of course, if you want a list that you can further manipulate, you can still do something like
List<File> tempList = new ArrayList<File>(Arrays.asList(temp));
    List<File> tempList = new ArrayList<>(Arrays.asList(temp));, note the diamond in ArrayList<>
temparray and add each File to thetempListArrayListusing a for loop will give you a warning in Android Studio that says it prefers you use theArrayList'saddAll()method. You could still do it, but for some reason Android Studio doesn't prefer it (maybe it's more efficient to use the method?)