title: Populating listview on main activity from another activity
body: <p>I managed to pass string to main activity from another by intent and showing it as textView. Is there a similar logic to populate the listview on main?</p>
  
  <pre><code>private Button startQr;
  private ListView validList;
  private ArrayList&lt;String&gt; strArray;
  private ArrayAdapter&lt;String&gt; adapter;
  // private TextView textView;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_my_caffe_list);
  
      validList = (ListView)findViewById(R.id.listView);
      startQr = (Button)findViewById(R.id.scanButton);
      strArray = new ArrayList&lt;&gt;();
      adapter = new ArrayAdapter&lt;String&gt;(getApplicationContext(),android.
      R.layout.simple_expandable_list_item_1, strArray);
      validList.setAdapter(adapter);
  
  
      startQr.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent i = new Intent(First.this, Second.class);
              startActivity(i);
          }
      });
  
      Intent intent = getIntent();
      String message = intent.getStringExtra(SecondActivity.EXTRA_MESSAGE);
      //textView = (TextView)findViewById(R.id.textView1);
      //textView.setText(message);
  </code></pre>
  
  <p>The second class:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.second_activity);
  
      btn = (Button)findViewById(R.id.button);
      btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              getCode();
              finish();
          }
      });
  
  }
  
  public void getCode() {
      Intent intent = new Intent( Secondclass.this, First.class);
      EditText editText = (EditText) findViewById(R.id.editText);
      String array = editText.getText().toString();
      intent.putExtra(EXTRA_ARRAY, array);
      startActivity(intent);
  }
  </code></pre>
  
  <p>It worked for a single editText.</p>