You have two ways for this.
First: onActivityResult
In Main Activity:
Use startActivityForResult(intent, ACTIVITY2)
and add this method
@Override
protected void onActivityResult (int requestCode, int resultCode, Intent intent)
{
if (resultCode == Activity.RESULT_OK)
{
String string_1 = intent.getStringExtra ("my_value_from_second_activity", "");
}
}
In Settings Activity:
Intent intent = new Intent ();
intent.putExtra ("my_value_from_second_activity", "hello");
activity.setResult (Activity.RESULT_OK, intent);
Second: SharedPreferences, the good way
Setting Activity:
SharedPreferences settings = getSharedPreferences("config", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putInt("my_value", edttext.getText().toString());
editor.commit();
Main Ativity:
SharedPreferences settings = getSharedPreferences("config", 0);
String value = settings.getString("my_value", "");