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

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

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

    hyljava

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



    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>
     <!-- 開發的應用適應的版本8代表Android2.2 -->
     <uses-sdk android:minSdkVersion="8" />
     <!-- 這里指定撥打電話的權限 -->
     <uses-permission android:name="android.permission.CALL_PHONE" />
    </manifest>
    hyl.xml
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
      <string name="mobellabel">請輸入手機號碼</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的第一個應用(撥打電話) 2012-09-05 11:08 anthony

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

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

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

    看來你想的很細的  回復  更多評論   

    主站蜘蛛池模板: 一级毛片免费在线播放| 91嫩草私人成人亚洲影院| 四虎影在线永久免费观看| 国产成人免费a在线资源| 国产成人精品久久亚洲| 亚洲AV无码成人网站久久精品大 | 女同免费毛片在线播放| 日本亚洲欧洲免费天堂午夜看片女人员| 暖暖在线视频免费视频| 国产亚洲综合成人91精品| 亚洲无mate20pro麻豆| 四虎精品成人免费视频| 精品熟女少妇av免费久久| 国产美女做a免费视频软件| 久久亚洲色WWW成人欧美| 久久国产精品免费网站| 亚洲一二成人精品区| 久久精品国产亚洲| 久久中文字幕免费视频| 亚洲国产精品人人做人人爽| 亚洲欧洲另类春色校园小说| gogo免费在线观看| 成人在线免费观看| 亚洲国产另类久久久精品| 黄色一级视频免费观看| 国产精品成人免费福利| 久久精品亚洲福利| 黄色一级免费网站| 亚洲人成人无码网www电影首页| 免费看一级高潮毛片| 永久免费观看的毛片的网站| 久久精品夜色国产亚洲av| 99久久99久久精品免费看蜜桃| 亚洲人成网站18禁止| 99在线观看视频免费| 亚洲V无码一区二区三区四区观看| 永久免费视频网站在线观看| 亚洲日韩激情无码一区| 在线v片免费观看视频| 亚洲自偷精品视频自拍| 国产成人精品免费视频软件|