<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    hyljava

    Android的第一個應(yīng)用(撥打電話)



    AndroidManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android=" package="com.hyl.phone" android:versionCode="1" android:versionName="1.0">
     <application android:icon="@drawable/maolv" android:label="@string/app_name">
      <activity android:name=".phoneActivity" android:label="@string/app_name">
       <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
       </intent-filter>
      </activity>

     </application>
     <!-- 開發(fā)的應(yīng)用適應(yīng)的版本8代表Android2.2 -->
     <uses-sdk android:minSdkVersion="8" />
     <!-- 這里指定撥打電話的權(quán)限 -->
     <uses-permission android:name="android.permission.CALL_PHONE" />
    </manifest>
    hyl.xml
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
      <string name="mobellabel">請輸入手機(jī)號碼</string>
        <string name="button">撥打此號碼</string>
     
    </resources>
    main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="
     android:orientation="vertical" android:layout_width="fill_parent"
     android:layout_height="fill_parent">
     <TextView android:layout_width="fill_parent"
      android:layout_height="wrap_content" android:text="@string/mobellabel"
      android:id="@+id/TextView01"
      
      />


     <EditText   android:id="@+id/EditText01"
      android:layout_width="fill_parent" android:layout_height="wrap_content" />
      
     <Button android:text="@string/button" android:id="@+id/Button01"
      android:layout_width="wrap_content" android:layout_height="wrap_content" />
    </LinearLayout>



    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);
      }
         
        }

     
    }







    posted on 2012-08-10 20:52 何云隆 閱讀(3076) 評論(2)  編輯  收藏 所屬分類: Android

    評論

    # re: Android的第一個應(yīng)用(撥打電話) 2012-09-05 11:08 anthony

    為什么不用編輯器?這代碼排版看得人不舒服。  回復(fù)  更多評論   

    # re: Android的第一個應(yīng)用(撥打電話) 2012-09-05 11:14 何云隆

    @anthony
    我直接從我的工程中復(fù)制出來的
    之后就這樣直接粘貼上了

    看來你想的很細(xì)的  回復(fù)  更多評論   

    主站蜘蛛池模板: 成人亚洲国产va天堂| gogo全球高清大胆亚洲| 亚洲s色大片在线观看| 免费夜色污私人影院网站| 日本免费观看网站| 亚洲性色AV日韩在线观看| 亚洲人成网站免费播放| 亚洲欧洲日产国码www| 1000部啪啪未满十八勿入免费 | 两性刺激生活片免费视频| 亚洲网址在线观看| 中文字幕av无码无卡免费| 亚洲三级中文字幕| 啦啦啦在线免费视频| 国产青草亚洲香蕉精品久久| 国产一级特黄高清免费大片| 一级毛片免费视频网站| 国产精品亚洲综合专区片高清久久久| 人碰人碰人成人免费视频| 亚洲精品成人无码中文毛片不卡| 免费精品久久天干天干| 亚洲黄色在线观看视频| 免费人成视频在线| 一区二区三区视频免费观看| 国产亚洲综合色就色| 亚洲一区免费视频| 午夜亚洲WWW湿好爽| 最新国产AV无码专区亚洲| 毛片无码免费无码播放| 自拍偷区亚洲国内自拍| 免费jlzzjlzz在线播放视频| a级毛片免费在线观看| 亚洲视频在线观看2018| 亚洲成人影院在线观看| 99热在线精品免费播放6| 亚洲熟妇AV一区二区三区宅男| 亚洲综合色视频在线观看| 免费在线视频你懂的| 黄色a三级免费看| 亚洲第一永久在线观看| 亚洲国产精品日韩|