How to Create an ArrayList

ArrayList was added in API Level 1

1. Open the MainActivity.java file and add the below line to the imports section.

import java.util.List;
import java.util.ArrayList;


2. In the onCreate method, add the following line to create String List Array. This will declare a List variable called myList.

    List<String> myList;

3. Add the bold line below to the onCreate method.

myList = new ArrayList<String>();

4. Compile and run!

Resources: