中文字幕第五页-中文字幕第页-中文字幕韩国-中文字幕最新-国产尤物二区三区在线观看-国产尤物福利视频一区二区

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

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

成都創新互聯專注為客戶提供全方位的互聯網綜合服務,包含不限于成都做網站、網站設計、川匯網絡推廣、小程序制作、川匯網絡營銷、川匯企業策劃、川匯品牌公關、搜索引擎seo、人物專訪、企業宣傳片、企業代運營等,從售前售中售后,我們都將竭誠為您服務,您的肯定,是我們最大的嘉獎;成都創新互聯為所有大學生創業者提供川匯建站搭建服務,24小時服務熱線:18982081108,官方網址:m.2m8n56k.cn

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

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

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】創建意圖對象

Intent intent =new Intent();

//【2】設置撥打電話的動作

intent.setAction(Intent.ACTION_CALL);

//【3】設置撥打的數據

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

//【4】開啟Activity

startActivity(intent);

}

//隱式意圖

public void click2(View v){

//[1]創建意圖對象

Intent intent=new Intent();

//[2]設置跳轉的動作

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

//設置category

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

//設置數據

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

//設置數據類型

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

//所以出現此種情況,我們應該調用如下編程

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

//開啟activity

startActivity(intent);

}

//顯示意圖

//點擊按鈕跳轉到 TestActivity 

public void click3(View v) {

//[1]創建意圖對象   意圖就是我要完成一件事 

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

//[2]設置包名和類名  packageName:當前應用的包名

//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{

//當Activity

@Override

protected void onCreate(Bundle savedInstanceState) {

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

super.onCreate(savedInstanceState);

//加載布局

setContentView(R.layout.activity_test);

}

}

layout——activitymain篇

<LinearLayout 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:orientation="vertical"

    tools:context=".MainActivity" >

    

    <Button

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:onClick="click1"

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

    <Button

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:onClick="click2"

    android:text="跳轉到activity"/>

    <Button

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:onClick="click3"

    android:text="跳轉到activity"/>

</LinearLayout>

activitymain——test3篇

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical" >

    <TextView 

        android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:text="wo shi test"

        />

</LinearLayout>

activitymain-test篇

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical" >

    <TextView

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:text="我是testActivity333" />

</LinearLayout>

android manifest篇

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.example.qingdan"

    android:versionCode="1"

    android:versionName="1.0" >

    <uses-sdk

        android:minSdkVersion="8"

        android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.CALL_PHONE"/>

 

    <application

        android:allowBackup="true"

        android:icon="@drawable/ic_launcher"

        android:label="@string/app_name"

        android:theme="@style/AppTheme" >

        <activity

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

              android:icon="@drawable/head1"

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

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

        </activity>

        <activity

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

             android:icon="@drawable/head2"

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

                               《!----》主入口》

            <intent-filter>

                <action android:name="com.iteheima.comm" />

                <data android:scheme="itheima"

                    android:mimeType="aa/bb"

                    />

                <category android:name="android.intent.category.DEFAULT" />

            </intent-filter>

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

            <intent-filter>

                <action android:name="com.iteheima.comm" />

                <data android:scheme="itheima"

                    android:mimeType="aa/bb"

                    />

                <category android:name="android.intent.category.DEFAULT" />

            </intent-filter>

            

        </activity>

         <!--配置Activity3  -->

        <activity android:name="com.example.qingdan.test3activity"></activity>

    </application>

</manifest>

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

當前名稱:android中顯示意圖和隱式意圖(附帶實現打電話)
標題鏈接:http://m.2m8n56k.cn/article40/ggdgeo.html

成都網站建設公司_創新互聯,為您提供移動網站建設外貿網站建設商城網站小程序開發域名注冊建站公司

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

成都網站建設
主站蜘蛛池模板: 免费一级做a爰片久久毛片 免费一级做a爰片性色毛片 | 国产精品国产国产aⅴ | 中文字幕在线播放视频 | 香蕉视频亚洲一级 | 成人a级| 日本美女一区二区三区 | 泷泽萝拉亚洲精品中文字幕 | 国产成人精品免费视频软件 | 国产手机在线视频 | 99久国产| 欧美大片一级特黄 | 国产三级在线视频播放线 | 国产韩国精品一区二区三区 | 成人在线免费视频 | 久久久综合视频 | 97视频网站 | 久久久久久久性高清毛片 | 亚洲区一区| 日本高清不卡在线观看 | 亚洲最大网站在线 | 久久91精品国产99久久yfo | 久久久亚洲精品蜜桃臀 | 97久久免费视频 | 久久精品视频91 | 亚洲精品久久久久久久777 | 欧美高清一区二区三区欧美 | 亚洲免费在线视频播放 | 色综合久久久久久 | 草草影院永久在线观看 | 久久爰www免费人成 久久曰视频 | 国产亚洲精品久久精品6 | 美女张开腿让男人桶爽动漫视频 | 毛片久久 | 久久国产精品岛国搬运工 | 欧美特级特黄a大片免费 | 亚洲美女自拍视频 | 高清性色生活片欧美在线 | 国产精品亚洲片夜色在线 | 精品久久影院 | 日韩欧美一区二区三区免费看 | 中文在线日韩 |