真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

android中顯示意圖和隱式意圖(附帶實現(xiàn)打電話)-創(chuàng)新互聯(lián)

未來的我,希望能看到這篇文章的時候,想一想什么都走過來了,還有什么走不得呢,無論何時何地,不要停下學(xué)習(xí)的腳步。

創(chuàng)新互聯(lián)建站堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站制作、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的撫遠(yuǎn)網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

android 中顯示意圖和隱式意圖(附帶實現(xiàn)打電話)

android 中顯示意圖和隱式意圖(附帶實現(xiàn)打電話)

mainactivity篇

package com.example.qingdan;

import android.os.Bundle;

import android.app.Activity;

import android.content.Intent;

import android.net.Uri;

import android.view.Menu;

import android.view.View;

public class MainActivity extends Activity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

}

public void click1(View v) {

//【1】創(chuàng)建意圖對象

Intent intent =new Intent();

//【2】設(shè)置撥打電話的動作

intent.setAction(Intent.ACTION_CALL);

//【3】設(shè)置撥打的數(shù)據(jù)

intent.setData(Uri.parse("tel:"+119));

//【4】開啟Activity

startActivity(intent);

}

//隱式意圖

public void click2(View v){

//[1]創(chuàng)建意圖對象

Intent intent=new Intent();

//[2]設(shè)置跳轉(zhuǎn)的動作

intent.setAction("com.iteheima.comm");

//設(shè)置category

intent.addCategory("android.intent.category.DEFAULT");

//設(shè)置數(shù)據(jù)

//intent.setData(Uri.parse("itheima:"+110));

//設(shè)置數(shù)據(jù)類型

//intent.setType("aa/bb");//調(diào)用setdate會自動清除setdata

//所以出現(xiàn)此種情況,我們應(yīng)該調(diào)用如下編程

intent.setDataAndType(Uri.parse("itheima:"+110), "aa/bb");//itheima是data中已經(jīng)配置好了的,所以上述同理只能用‘tel’

//開啟activity

startActivity(intent);

}

//顯示意圖

//點擊按鈕跳轉(zhuǎn)到 TestActivity

public void click3(View v) {

//[1]創(chuàng)建意圖對象  意圖就是我要完成一件事

Intent intent = new Intent(this,test3activity.class);

//[2]設(shè)置包名和類名 packageName:當(dāng)前應(yīng)用的包名

//intent.setClassName("com.itheima.newactivity", "com.itheima.newactivity.Test3Activity");

//[3]開啟Activity

startActivity(intent);

}

}

test3activity篇

package com.example.qingdan;

import android.os.Bundle;

import android.app.Activity;

public class test3activity extends Activity{

@Override

protected void onCreate(Bundle savedInstanceState) {

// TODO 自動生成的方法存根

super.onCreate(savedInstanceState);

//加載布局

setContentView(R.layout.activity_test);

}

}

testactivity篇

package com.example.qingdan;

import android.app.Activity;

import android.os.Bundle;

public class testactivity extends Activity{

//當(dāng)Activity

@Override

protected void onCreate(Bundle savedInstanceState) {

// TODO 自動生成的方法存根

super.onCreate(savedInstanceState);

//加載布局

setContentView(R.layout.activity_test);

}

}

layout——activitymain篇

  xmlns:tools="http://schemas.android.com/tools"

  android:layout_width="match_parent"

  android:layout_height="match_parent"

  android:orientation="vertical"

  tools:context=".MainActivity" >

  

  android:layout_width="wrap_content"

  android:layout_height="wrap_content"

  android:onClick="click1"

  android:text="撥打電話"/>

  

  android:layout_width="wrap_content"

  android:layout_height="wrap_content"

  android:onClick="click2"

  android:text="跳轉(zhuǎn)到activity"/>

  

  android:layout_width="wrap_content"

  android:layout_height="wrap_content"

  android:onClick="click3"

  android:text="跳轉(zhuǎn)到activity"/>

activitymain——test3篇

  android:layout_width="match_parent"

  android:layout_height="match_parent"

  android:orientation="vertical" >

  

    android:layout_width="match_parent"

  android:layout_height="wrap_content"

  android:text="wo shi test"

    />

activitymain-test篇

  android:layout_width="match_parent"

  android:layout_height="match_parent"

  android:orientation="vertical" >

  

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:text="我是testActivity333" />

android manifest篇

  package="com.example.qingdan"

  android:versionCode="1"

  android:versionName="1.0" >

  

    android:minSdkVersion="8"

    android:targetSdkVersion="17" />

  

  

    android:allowBackup="true"

    android:icon="@drawable/ic_launcher"

    android:label="@string/app_name"

    android:theme="@style/AppTheme" >

    

      android:name="com.example.qingdan.MainActivity"

       android:icon="@drawable/head1"

      android:label="我是第二個頁面" >

      

        

        

      

    

    

      android:name="com.example.qingdan.testactivity"

       android:icon="@drawable/head2"

      android:label="我是第一個頁面" >

                《!----》主入口》

      

        

        

          android:mimeType="aa/bb"

          />

        

      

      《!我們可以創(chuàng)建出多個過濾器,只要,前面name,category能匹配到就行了,有一個就行哪怕data改變也可以》

      

        

        

          android:mimeType="aa/bb"

          />

        

      

    

     

    

  

ok,結(jié)束,主要是自己太累了,想休息一會,就這樣吧

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。


文章名稱:android中顯示意圖和隱式意圖(附帶實現(xiàn)打電話)-創(chuàng)新互聯(lián)
當(dāng)前網(wǎng)址:http://weahome.cn/article/ddppee.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部