Android implements simple dialer functions

The manufacturing method of simple dialer is as follows

1、 Layout structure

Construct the layout as shown in the figure

2、 Grant software call permission

Add the following code in androidmanifest.xml

Grant the software the right to make a phone call, otherwise you can't make a phone call

3、 Write code (applicable to Android 6.0 and below)

1) . define an external class to implement the interface type required by setonclicklistener

2) The anonymous inner class implements the interface type required by setonclicklistener

4、 Write code (for Android 6.0 and above)

On Android 6.0 and above platforms, even if the call permission has been added, the runtime will still report an error security exception: the permission is denied. You should check whether the application is granted phone permission when the application starts.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>