简体   繁体   English

单击首选项时跳转到拨号程序或任何默认的呼叫者应用程序

[英]Jump to Dialer or any default Caller App when clicking on a Preference item

My question is pretty closed to reacting-to-a-click-on-a-preference我的问题非常接近于对点击偏好做出反应

I want to use Intent + android:action in my R.xml.preferences file instead of setting up OnClickListener on a certain preference item as below我想在我的 R.xml.preferences 文件中使用 Intent + android:action 而不是在某个首选项上设置 OnClickListener,如下所示

    <Preference android:title="@string/pref_cat3_call_center">
        <intent
            android:action="android.intent.action.DIAL"
            android:data="1112223333" />
    </Preference>

While I always encounter the exception虽然我总是遇到异常

android.content.ActivityNotFoundException: 
No Activity found to handle Intent { act=android.intent.action.DIAL dat=+1112223333}

Is this idea possible, or I have to use OnClickListener?这个想法可行吗,或者我必须使用 OnClickListener?

Phone apps support Uri 's in the form of tel:XXX .电话应用程序以tel:XXX的形式支持Uri

Change your android:data value to "tel:1112223333"将您的android:data值更改为"tel:1112223333"

See: https://developer.android.com/reference/android/content/Intent#ACTION_DIAL请参阅: https : //developer.android.com/reference/android/content/Intent#ACTION_DIAL

Input: If nothing, an empty dialer is started;输入:如果没有,则启动一个空拨号器; else getData() is URI of a phone number to be dialed or a tel: URI of an explicit phone number . else getData() 是要拨打的电话号码的URI 或 tel: 显式电话号码的 URI

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单击列表首选项时应用崩溃 - App Crashing when clicking on list preference 启动默认拨号器应用程序时返回数据-Android - Data back when default dialer app is launched - Android 在数组排序行上单击具有 OnItemClickListener 的任何项目时,应用程序崩溃 - App crashes when clicking on any item with OnItemClickListener on array sort line 如何在 AOSP 中将我的自定义拨号器应用程序设置为默认拨号器 - How to set my custom dialer app as default dialer in AOSP 在应用中打开/显示默认拨号程序(实际上是使用拨号程序而不向其传递数据)? - Opening/Displaying the default dialer in app (actually using the dialer not passing data to it)? Android:如何像真正的调用程序一样将拨号程序集成到应用程序中 - Android : How to integrate dialer in app like true caller 单击android studio中操作栏菜单中的项目时跳转到另一个活动 - Jump to another activity when clicking a item in menu of actionbar in android studio 如何检测默认拨号器应用程序更改? - How to detect Default Dialer app changes? 使用默认拨号器应用取消拨出电话 - cancel outgoing call with default dialer app Android:如何制作默认的拨号器应用程序? - Android: How to make a default dialer app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM