Why can't I see the findings?

I want to get data from second activity and display them in a listView in the first, but for some reason on the screen nothing appears.

The code itself:

The first activity I create a second activity and output the on-screen listView

public class MainActivity extends AppCompatActivity {

 public List<String> list;

@Override
 protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R. layout.activity_main);

 list = new ArrayList<>();

 ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R. layout.array_adapter, list);

 ListView lv = (ListView)findViewById(R. id.listView);
lv.setAdapter(adapter);
}

@Override
 protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
 super.onActivityResult(requestCode, resultCode, data);

 Intent intent = getIntent();
 String item = intent.getStringExtra("main");
list.add(item);
}

 public void floatinButton1OnClick(View View) {
 Intent intent = new Intent(this, AddElement.class);
 startActivityForResult(intent, 1);
}
}


The second activity I read the data from editText and pass it on to the first activity
public class AddElement extends AppCompatActivity {

@Override
 protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R. layout.add_element);
}

 public void floatingButton1OnClick_AddElement(View View) {

 TextView textView = (TextView)findViewById(R. id.editText1_add_element);
 String main_item = textView.getText().toString();

 Intent intent = new Intent(this, MainActivity.class);
 intent.putExtra("main", main_item);

 setResult(RESULT_OK, intent);
finish();
 }
April 4th 20 at 00:46
1 answer
April 4th 20 at 00:48
So you just add the item to the list, and the adapter this is not brief, and therefore not displayed

Find more questions by tags JavaAndroid