One option would be to use the onResume of your first activity.
@Override
public void onResume()
{ // After a pause OR at startup
super.onResume();
//Refresh your stuff here
}
Or you can start Activity for Result:
Intent i = new Intent(this, SecondActivity.class);
startActivityForResult(i, 1);
In secondActivity if you want to send back data:
Intent returnIntent = new Intent();
returnIntent.putExtra("result",result);
setResult(RESULT_OK,returnIntent);
finish();
if you don't want to return data:
Intent returnIntent = new Intent();
setResult(RESULT_CANCELED, returnIntent);
finish();
Now in your FirstActivity class write following code for onActivityResult()
method
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if(resultCode == RESULT_OK){
//Update List
}
if (resultCode == RESULT_CANCELED) {
//Do nothing?
}
}
}//onActivityResult
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…