Rohit Bajaj
asked on
closing a parent activity from within a child activity
Hi,
I am starting a new activity from my existing one like this -
Tring.java
Intent intent = new Intent(tring, NumberActivity.class);
startActivityForResult(int ent,1);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(req uestCode, resultCode, data);
Log.d("Tring","Inside onActivityResult of Tring");
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
this.finish();
}
}
}
Now in NumberActivity.java i have the following piece of code :
setResult(RESULT_OK, null);
finish();
According to what i have read this should close out my current Activity (ie. NumberActivity) and call onActivityResult method of Tring.java inside which i have made a call to finish. so the parent activity gets finished.
But this is not happening.
Please help.
thanks
I am starting a new activity from my existing one like this -
Tring.java
Intent intent = new Intent(tring, NumberActivity.class);
startActivityForResult(int
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(req
Log.d("Tring","Inside onActivityResult of Tring");
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
this.finish();
}
}
}
Now in NumberActivity.java i have the following piece of code :
setResult(RESULT_OK, null);
finish();
According to what i have read this should close out my current Activity (ie. NumberActivity) and call onActivityResult method of Tring.java inside which i have made a call to finish. so the parent activity gets finished.
But this is not happening.
Please help.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.