whenever i try to edit the content of a list view or and text view through the java code my app just crashes and stops working
when i comment the line of code which edit the content the just works fine
in the following example when comment the line
lv1.setAdapter(AA1);
the app works
package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
ListView lv1;
ArrayAdapter<String> AA1;
ArrayList<String> names;
@Override
protected void onCreate(Bundle savedInstanceState) {
lv1= findViewById(R.id.lv1);
names = new ArrayList<String>();
names.add("Jake");
names.add("Amy");
names.add("Diaz");
names.add("Boyl");
AA1 = new ArrayAdapter<String >(this,android.R.layout.simple_list_item_1,names);
lv1.setAdapter(AA1);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}