In my first Activity I made that you can open a pop-up window (it's another activity), where you can put some data in and it needs to be sent back to the original Activity. Since I will need to put the data I got into a ListView, I think I need to check if the button is pressend and in the onClick add to the ListView. How to do that?
Here's the code of the pop-up Activity:
public class AddCoin extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        final Intent intentAdd = new Intent(this, PortfolioActivity.class);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_coin_window);
        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        int width = dm.widthPixels;
        int height = dm.heightPixels;
        getWindow().setLayout((int)(width*.8), (int)(height*0.4));
        Button add_coin = findViewById(R.id.add_toport_button);
        add_coin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                EditText inputNameText = (EditText) findViewById(R.id.text_input_name);
                EditText inputPriceText = (EditText) findViewById(R.id.text_input_price);
                EditText inputAmmountText = (EditText) findViewById(R.id.text_input_ammount);
                String inputName = inputNameText.getText().toString();
                String inputPrice = inputPriceText.getText().toString();
                String inputAmmount = inputAmmountText.getText().toString();
                intentAdd.putExtra("Name", inputName);
                intentAdd.putExtra("Price", inputPrice);
                intentAdd.putExtra("Ammount", inputAmmount);
                finish();
            }
        });
    }
}
 
     
     
     
    