热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

android拨打多个电话,Android的第一个应用(拨打电话)

AndroidManifest.xmlpackagecom.hyl.phoneandroid:versionCode1android:versionName1.0hy

cc8a9a48d8a8695c82df26dc86f1d0e4.png

AndroidManifest.xml

package="com.hyl.phone" android:versionCode="1" android:versionName="1.0">

hyl.xml

请输入手机号码

拨打此号码

main.xml

android:orientation="vertical" android:layout_width="fill_parent"

android:layout_height="fill_parent">

android:layout_height="wrap_content" android:text="@string/mobellabel"

android:id="@+id/TextView01"

/>

android:layout_width="fill_parent" android:layout_height="wrap_content" />

android:layout_width="wrap_content" android:layout_height="wrap_content" />

phoneActivity.java

package com.hyl.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 phoneActivity extends Activity {

/** Called when the activity is first created. */

private Button button;

private EditText editText;

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

button=  (Button)this.findViewById(R.id.Button01);

editText=(EditText) this.findViewById(R.id.EditText01);

button.setOnClickListener(new ButtonListener());

}

private final class ButtonListener implements View.OnClickListener{

public void onClick(View v) {

String phonenum=editText.getText().toString();

//android.intent.action.CALL=Intent.ACTION_CALL

Intent intent=new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+phonenum));

startActivity(intent);

}

}

}

89a2fd3c56525495e01cf6e3258a8753.png

0239dfcdc77e72de9079959e5fd66e72.png

867882c33633de94f1214889cb991bc0.png



推荐阅读
author-avatar
灬我的独一小姐灬
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有