欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Android實(shí)現(xiàn)撥號(hào)器電話

xml中的代碼實(shí)現(xiàn)

企業(yè)建站必須是能夠以充分展現(xiàn)企業(yè)形象為主要目的,是企業(yè)文化與產(chǎn)品對外擴(kuò)展宣傳的重要窗口,一個(gè)合格的網(wǎng)站不僅僅能為公司帶來巨大的互聯(lián)網(wǎng)上的收集和信息發(fā)布平臺(tái),成都創(chuàng)新互聯(lián)公司面向各種領(lǐng)域:成都搬家公司網(wǎng)站設(shè)計(jì)、全網(wǎng)整合營銷推廣解決方案、網(wǎng)站設(shè)計(jì)等建站排名服務(wù)。


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="20dp"
 >

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/title" />
   <EditText 
       android:id="@+id/phonenumber"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:hint="請輸入手機(jī)號(hào)碼"
       android:inputType="phone"
       android:layout_below="@id/title"
       
       />
	<Button 
	    android:id="@+id/but"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:onClick="call"
	    android:text="撥打"
	    android:layout_below="@id/phonenumber"
	    />
</RelativeLayout>

mainActivity中代碼的實(shí)現(xiàn)

public class MainActivity extends Activity {
	private EditText edit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        edit=(EditText)findViewById(R.id.phonenumber);
    }

	public  void call(View v){
	System.out.println("被點(diǎn)擊了");
	String num=edit.getText().toString();
	 
	Intent intent=new Intent();//創(chuàng)建一個(gè)意圖
	intent.setAction(intent.ACTION_CALL);//指定動(dòng)作為撥打電話
	intent.setData(Uri.parse("tel:"+num));//指定要播出的電話號(hào)碼
	startActivity(intent);
	
	}
  
}

同時(shí)還需要給我們的應(yīng)用程序添加一個(gè)可以撥打號(hào)碼的權(quán)限

<!-- 添加撥打電話的權(quán)限 -->
	<uses-permission 
	    android:name="android.permission.CALL_PHONE"
	    />

本文名稱:Android實(shí)現(xiàn)撥號(hào)器電話
網(wǎng)站URL:http://chinadenli.net/article38/pgphpp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、微信小程序、標(biāo)簽優(yōu)化、外貿(mào)建站、品牌網(wǎng)站設(shè)計(jì)網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化