Detailed explanation of telephone dialer example developed by Android

This paper analyzes the usage of telephone dialer developed by Android. Share with you for your reference, as follows:

1. Create a new Android project named javacallphone, and create a callphoneactivity.java class under cn.csdn.hr.activity package

2. Open main.xml under layout under res for layout, set the layout mode to horizontal layout, and then drag the textview, phone under text files, and button buttons from the left. The effect is as follows through new string:

3. Open callphoneactivity.java to write. The specific code is as follows:

4. Open the project list file Android manifest.xml, select permissions, and add the user's call permission, as shown in the following figure:

5. Appears in the source code:

6. Finally, run as Android application to realize the dialing function

Supplement: Android telephone dialer Development Notes

AndroidActivity:

mian.xml:

Strings.xml:

Requirements:

Procedure steps for making calls

1. Configuration file

The page that strings.xml is responsible for is text

Main.xml is responsible for page layout and ID 2.java code of each space:

Get button by ID

Listening button (parameter view) 3. Myoncliocklistenr

Event handling: get EditText and get the reference of phone number creation intention: intent intrnt = new intent(); Set the action of the intention object setaction() dial the phone number setdata() turn on the intention statachieve (intent) modify the security exception: permissions -- > android.permission.call in androidmainfest.xml_ PHONE

I hope this article will help you in Android programming.

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
分享
二维码
< <上一篇
下一篇>>