Here's an example of how you could implement a list view:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//We have our list view
final ListView dynamic = findViewById(R.id.dynamic);
//Create an array of elements
final ArrayList<String> classes = new ArrayList<>();
classes.add("Data Structures");
classes.add("Assembly Language");
classes.add("Calculus 3");
classes.add("Switching Systems");
classes.add("Analysis Tools");
//Create adapter for ArrayList
final ArrayAdapter<String> adapter = new ArrayAdapter<>(this,android.R.layout.simple_list_item_1, classes);
//Insert Adapter into List
dynamic.setAdapter(adapter);
//set click functionality for each list item
dynamic.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.i("User clicked ", classes.get(position));
}
});
}