How to open dialer and get back to your app in one step in Android

一笑奈何 提交于 2020-01-14 09:57:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!