I want to select an item from a list. When this item is clicked, I want to open a new activity and have the related item shown in the next activity. This is the code for my click listener:
listView.setOnClickListener(new AdapterView.OnClickListener() {
    String item = (String) adapterView.getItemAtPosition(i);
    public onClick(AdapterView<?> adapterView, View view, int i, long l) {
        // Getting item text to be able to show it in a toast.
        String item = (String) adapterView.getItemAtPosition(i);
        Intent intent = new Intent(MainActivity.this, AddPlaneActivity.class);
        startActivity(intent);
    }
});
 
     
     
    