Android编程简单实现拨号器功能的方法

  

本文实例讲述了Android编程简单实现拨号器功能的方法。分享给大家供大家参考,具体如下:

  

学习Android已经有2天时间了,没学习的时候觉得Android可能很枯燥,但是学过之后我发觉其实这个比什么javaweb好玩多了。学习Android可以见到一些很有趣的东西,这里呢也建议学习javaME的人不要在煎熬了,学习安卓吧。在写程序之前也需要知道Android的工作原理

  

  

看过网上android的开发流程,好多人都说可以把界面和活动并行开发,因为android也是遵循mvc设计模式,也就是说安卓也可有自己的业务层刀。由于android发展历史比较短,目前的分工还不是很明确,对于界面和后台可以选择其中一个作为自己的发展方向,对于android的任何一块来说薪水都比较高。废话就不多说了,来一步一步的实现功能吧。

  

1。编写“文”字的配置文件,默认的配置文件是strings.xml,这里也可以重新写一个配置文件,格式要保持一致就来写这个配置文件(mystring.xml)吧

        & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比;   & lt; resources>   & lt;字符串名称="小费"祝辞输入号码& lt;/string>   & lt;字符串名称=" bottonname "祝辞拨打& lt;/string>   & lt;/resources>      之前      

2。编写控件

        & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比;   & lt; LinearLayout xmlns: android=" http://schemas.android.com/apk/res/android "   android:取向=按怪薄盿ndroid: layout_width=翱砗汀?   android: layout_height=翱砗汀北?& lt; !——线性布局——比;   & lt; TextView android: layout_width="宽和"   android: layout_height=" wrap_content "   android:文本=癅string/提示”/比;   & lt; EditText android: layout_width="宽和"   android: layout_height=" wrap_content "   android: id=癅 + id/phonenumber”/比;& lt; !——显示一个文本框id为phonenumber——比;   & lt;按钮android: layout_width=" wrap_content "   android: layout_height=" wrap_content "   android:文本=" @string/bottonname”   android: id=癅 + id/波顿”/比;& lt; !——显示一个按钮——比;   & lt;/LinearLayout>      之前      

为了让大家看的更清楚,我把R文件的内容也给大家

     /*自动生成的文件。不要修改。   *   *这类自动生成的   从资源数据发现* aapt工具。它   *不应该手工修改。   */包org.lxh.phone;   最后公共类R {   公共静态最终类attr {   }   公共静态最终类可拉的{   公共静态最终int图标=0 x7f020000;   }   公共静态最终类id {   公共静态最终int波顿=0 x7f050001;   公共静态最终int phonenumber=0 x7f050000;   }   公共静态最终类布局{   公共静态最终int主要=0 x7f030000;   }   公共静态最终类字符串{   公共静态最终int app_name=0 x7f040003;   公共静态最终int bottonname=0 x7f040001;   公共静态最终int你好=0 x7f040002;   公共静态最终int提示=0 x7f040000;   }   }      之前      

3。编写活动

        包org.lxh.phone;   进口android.app.Activity;   进口android.content.Intent;   进口android.net.Uri;   进口android.os.Bundle;   进口android.view.View;   进口android.widget.Button;   进口android.widget.EditText;   公开课PhoneActivity延伸活动{   私人EditText编辑;   公共空间>   包org.lxh.activity;   进口android.app.Activity;   进口android.content.Intent;   进口android.net.Uri;   进口android.os.Bundle;   进口android.view.View;   进口android.widget.Button;   进口android.widget.EditText;   公开课CallPhoneActivity延伸活动{   私人EditText EditText;   公共空间>   & lt;活动android: name=" OutgoingCallBroadcaster "   android:许可=" android.permission.CALL_PHONE "   android:主题=" @android:风格/Theme.NoDisplay”   面向android: configChanges=" | keyboardHidden”比;   & lt; !——调用行动意图过滤器,各种方式   启动一个外向的电话。——比;   & lt; intent-filter>   & lt;行动android: name=" android.intent.action.CALL "/比;   & lt;类别android: name=" android.intent.category.DEFAULT "/比;   & lt;数据android:方案="电话"/比;   & lt;/intent-filter>   & lt; intent-filter>   & lt;行动android: name=" android.intent.action.CALL "/比;   & lt;类别android: name=" android.intent.category.DEFAULT "/比;   & lt;数据android:方案=坝镆粜畔洹?比;   & lt;/intent-filter>   & lt; intent-filter>   & lt;行动android: name=" android.intent.action.CALL "/比;   & lt;类别android: name=" android.intent.category.DEFAULT "/比;   & lt;数据android: mimeType=" vnd.android.cursor。项目/手机/比;   & lt;数据android: mimeType=" vnd.android.cursor。项目/phone_v2”/比;   & lt;数据android: mimeType=" vnd.android.cursor。项目/人”在   & lt;/intent-filter>   & lt;/activity>      

Android编程简单实现拨号器功能的方法