I'm still quite new to android programming. I currently have a button on the home page that takes the user to a second activity. On the second activity, the user fills in two EditText boxes and clicks a button at the bottom of the page that should send information that the user entered with it. The button that returns to the main activity uses the following code:
Intent returnIntent = new Intent();
String strData = "your data";
EditText foodName = ((EditText) findViewById(R.id.foodLabel));
String foodNameString = foodName.getText().toString();
returnIntent.putExtra("data", foodNameString);
setResult(RESULT_OK, returnIntent);
finish();
Where would I put code in my main activity that should run as soon as this button is clicked? And how can I access the information I sent back? Right now it returns to the main activity but does nothing.