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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值