设为首页 加入收藏

TOP

Android拨号器的实现
2014-11-24 03:27:11 来源: 作者: 【 】 浏览:1
Tags:Android 拨号器 实现

再次:编写代码
package com.sharpandroid.phone;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class SharpPhoneActivity extends Activity {


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View e) {
// 获取手机号
EditText phonenoText = (EditText) findViewById(R.id.phoneno);
String phoneno = phonenoText.getText().toString();
if ((phoneno != null) && (!"".equals(phoneno.trim()))) {
Intent intent = new Intent(Intent.ACTION_CALL, Uri
.parse("tel:" + phoneno));
startActivity(intent);
}}});}}


最后在AndroidManifest.xml的配置文件中添加以下粗体字代码
< xml version="1.0" encoding="utf-8" >
package="com.sharpandroid.phone" android:versionCode="1"
android:versionName="1.0">











】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇获取Android 2.2下的软件安装位置 下一篇Linux下Driver开发

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Shell脚本:Linux Sh (2025-12-25 05:50:11)
·VMware虚拟机安装Lin (2025-12-25 05:50:08)
·Linux学习教程,Linu (2025-12-25 05:50:06)
·工业机器人TCP校准中 (2025-12-25 05:19:17)
·opc 通讯协议与 TCP (2025-12-25 05:19:15)