Reputation: 2755
friends,
i have three activities
A,B,C
A is home screen.
Activities are launched as follow A->B->C
in activity B i am writing the following code.
Intent i = new Intent(Intent.ACTION_DIAL);
String p = "tel:" + getString(R.string.phone_number);
i.setData(Uri.parse(p));
startActivity(i);
for that it goes to the dail pad and then when pressing device back button it goes to A.my requirement is go to the B.
please help me . Thanks in advance.
Intent i = new Intent(Intent.ACTION_DIAL);
String p = "tel:" + getString(R.string.phone_number);
i.setData(Uri.parse(p));
startActivity(i);
Upvotes: 1
Views: 490
Reputation: 3220
You can use startActivityforResult().
When starting the activity use. startActivityForResult(intent, requestCode);
Intent i = new Intent(Intent.ACTION_DIAL);
String p = "tel:" + getString(R.string.phone_number);
i.setData(Uri.parse(p));
startActivityForResult(i, 0);
Method
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
will be called when activity will be returned.
Upvotes: 1
Reputation: 2624
You can override onBackPressed method to control the behaviour of Back button:
@Override
public void onBackPressed() {
// code to go to Activity B.
}
Upvotes: 0