打开电话Android系统调用
本文個人在廣東逛街的時候突然想到的...之前就有想寫幾篇關于打開電話的博客,所以回家到之后就奮筆疾書的寫出來發布了
????main.xml如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="vertical"android:gravity="center_horizontal"><Buttonandroid:id="@+id/callTelephoneButton"android:layout_width="150dip"android:layout_height="40dip"android:gravity="center"android:text="@string/callTelephone"android:layout_marginTop="50dip"android:textSize="20sp"/><Buttonandroid:id="@+id/browsephotosButton"android:layout_width="150dip"android:layout_height="40dip"android:gravity="center"android:text="@string/browsephotos"android:layout_marginTop="50dip"android:textSize="20sp"/><Buttonandroid:id="@+id/openBrowserButton"android:layout_width="150dip"android:layout_height="40dip"android:gravity="center"android:text="@string/openBrowser"android:layout_marginTop="50dip"android:textSize="20sp"/><Buttonandroid:id="@+id/openCameraButton"android:layout_width="150dip"android:layout_height="40dip"android:gravity="center"android:text="@string/openCamera"android:layout_marginTop="50dip"android:textSize="20sp"/></LinearLayout>????MainActivity如下:
每日一道理盈盈月光,我掬一杯最清的;落落余輝,我擁一縷最暖的;灼灼紅葉,我拾一片最熱的;萋萋芳草,我摘一束最燦的;漫漫人生,我要采擷世間最重的———毅力。
package cn.com.bravesoft.testintent; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.app.Activity; import android.content.Intent; /*** *官方資料:*1 權限設置* http://developer.android.com/reference/android/Manifest.permission.html*2 系統Intent* http://developer.android.com/reference/android/content/Intent.html#ACTION_CALL*/ public class MainActivity extends Activity {private Button mTelephoneButton;private Button mPhotosButton;private Button mBrowserButton;private Button mCameraButton;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);init();}private void init(){mTelephoneButton=(Button) findViewById(R.id.callTelephoneButton);mTelephoneButton.setOnClickListener(new ButtonOnClickListenerImpl());mPhotosButton=(Button) findViewById(R.id.browsephotosButton);mPhotosButton.setOnClickListener(new ButtonOnClickListenerImpl());mBrowserButton=(Button) findViewById(R.id.openBrowserButton);mBrowserButton.setOnClickListener(new ButtonOnClickListenerImpl());mCameraButton=(Button) findViewById(R.id.openCameraButton);mCameraButton.setOnClickListener(new ButtonOnClickListenerImpl());}private class ButtonOnClickListenerImpl implements OnClickListener{@Overridepublic void onClick(View v) {switch (v.getId()) {case R.id.callTelephoneButton://撥打電話Intent telephoneIntent=new Intent();telephoneIntent.setAction("android.intent.action.CALL");telephoneIntent.setData(Uri.parse("tel:"+"150028068"));startActivity(telephoneIntent);break;case R.id.browsephotosButton://查看圖片Intent galleryIntent=new Intent();galleryIntent.setAction(Intent.ACTION_GET_CONTENT);galleryIntent.setType("image/*");startActivity(galleryIntent);break;case R.id.openBrowserButton://打開瀏覽器Intent browserIntent=new Intent();browserIntent.setAction(Intent.ACTION_VIEW);browserIntent.setData(Uri.parse("http://www.ifeng.com"));startActivity(browserIntent);break;case R.id.openCameraButton://打開照相機Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivity(cameraIntent);break;default:break;}}} }
????
?
文章結束給大家分享下程序員的一些笑話語錄: 話劇:程序員過溝
本劇內容純屬虛構,如有雷同……HEHE……俺也沒辦法了。
話說某市街道改建,某某軟件公司門口橫七豎八挖了幾條大溝。一群程序員(SDK程序員趙某,VB程序員錢某,VC程序員孫某,DELPHI程序員李某)下班從公司里出來,看到門前的幾條溝,于是各顯神通……門前第一條溝也就半米來寬,SDK程序員趙某二話沒說,輕輕一躍跳了過去,看到其它人紛紛把隨身攜帶的公文包(類庫)橫在溝上踩著過溝,不屑地說,這么小一條溝,犯得著小題大做用那個嗎?看我多么輕松多么灑脫多么……多么……(眾人皆怒目橫視之……)
接著第二條溝有點寬度。SDK程序員趙某還是還是一馬當先,飛躍而起……不好,還差一點才到……幸好憑著多年的(跳遠?編程?)經驗,單手抓住溝沿,顫巍巍地爬了上來,嘴里還念念有詞“高手就是高手啊,雖然差一點就……不過畢竟……HEHE……跳遠是過溝的基礎嘛,有基礎(SDK)就有一切的說……”(眾人作瞠目結舌狀……)看到別人跳過去了,可自己又跳不了那么遠,只好再想辦法了……VB程序員錢某,DELPHI程序員李某打開手提,連上手機,開始上網找可供過溝的控件……VC程序員孫某卻不慌不忙,打開公文包,把幾塊襯板拆了下來,然后三下五除二拼成一個簡易木橋……“雖然這幾個板子(類)做得不怎么樣,不過先把這個項目應付過去,有時間我自己做一個好了……”于是踩著板子過了溝。
這時錢某和李某也分別找到了合適的東東。錢某找到的是“鋼絲繩.ocx”,安裝簡單,使用方便,拉出一頭,對孫某說“大蝦,順手拉兄弟一把……”,于是把繩子系在溝兩邊的綠化樹木上,踩著鋼絲就過了溝。剛剛站穩就四方作揖,“小生這里有禮了”。這時一戴著黃袖圈的老太太跳了出來,抓住錢某,“破壞綠化樹木,罰款XXXX元,交錢,交錢,交錢!”(老人家作雙槍老太婆怒視偽軍狀
……錢某被逼無奈,只好邊掏錢,邊對著后臺叫道“導演,我這可是因公犧牲,不給個烈士稱號也得報銷”,后臺一個臭雞蛋飛出,“叫什么叫,我這個月的糧餉還不知哪里去領呢,都什么時代了,你不下崗都不錯了……”)
李某看著剛剛好不容易從臺灣拖回來的“鋁條.ZIP”
轉載于:https://www.cnblogs.com/xinyuyuanm/archive/2013/05/19/3087539.html
總結
以上是生活随笔為你收集整理的打开电话Android系统调用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaScript中的数组循环方法
- 下一篇: js一个典型的对象写法,推荐使用这种格式