问题
In my application I have a button with telephone number, and when user clicks on it the Dialer app is opened with the number in phone field. However if I want to get back from dialer to my app I should press 'Back' button 3 times. First press closes the dialer keyboard, second press brings me to dialer history menu, and only 3 press reopens my app. Is it possible to get back in 1 back button press?
Here is my button OnClickListener
vPhone.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
intent.setData(Uri.parse("tel:" + phone));
startActivity(intent);
}
});
来源:https://stackoverflow.com/questions/40220279/how-to-open-dialer-and-get-back-to-your-app-in-one-step-in-android