/**
             * 方法一:在构造函数中指定
             */
            /*Intent intent=new Intent(this,TwoActivity.class);
            startActivity(intent);*/
            
            /**
             * 方法二:用 setClass 方法
             */
            /*Intent intent=new Intent();
            intent.setClass(this, TwoActivity.class);
            startActivity(intent);*/
            
            /**
             * 方法三:用 setClassName 方法(第一个参数是上下文,第二个参数是要跳转的Activity的包名)
             */
            /*Intent intent=new Intent();
            intent.setClassName(this, "com.example.yinshitiaozhuan.TwoActivity");
            startActivity(intent);*/
            
            /**
             * 方法四:用 setComponent 方法
             */
            /*Intent intent=new Intent();
            //设置组件//setComponent方法的参数:ComponentName
            intent.setComponent(new ComponentName(this, TwoActivity.class));
            startActivity(intent);*/
            
            /**
             * 方法五:用 setComponent 方法
             */
            /*Intent intent=new Intent();
            //设置组件//setComponent方法的参数:ComponentName
            intent.setComponent(new ComponentName(this, "com.example.yinshitiaozhuan.TwoActivity"));
            startActivity(intent);*/
            
 //-------------------------注:下面的隐士跳转需要在清单文件中注册---------------------------------------

清单文件中:

<activity
            android:name="com.example.yinshitiaozhuan.TwoActivity"
            android:label="@string/title_activity_two">
            
            <intent-filter>
                <action android:name="com.example.yinshitiaozhuan.TwoActivity"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>

//--------------------------------------------------------------------------------  
            /**
             * 方法6:隐士跳转
             */
              //创建一个隐式的 Intent 对象:Action 动作
            /*Intent intent=new Intent();
               //设置 Intent 的动作
            intent.setAction("com.example.yinshitiaozhuan.TwoActivity");
            
            startActivity(intent);*/

/**
             * 方法7://设置壁纸
             */
            /*Intent intent=new Intent(Intent.ACTION_SET_WALLPAPER);
            startActivity(Intent.createChooser(intent, "设置壁纸"));*/
            
            
            /**
             * 方法8:   //调用搜索
             */
            /*Intent intent=new Intent();
            intent.setAction(Intent.ACTION_WEB_SEARCH);
            startActivity(intent);*/
            
            /**
             * 方法9:   //卸载APK   
             */
            Uri uri = Uri.fromParts("package", "com.example.yinshitiaozhuan", null);   
            Intent intent = new Intent(Intent.ACTION_DELETE, uri);    
            startActivity(intent);

//------------一下是我学习的博客---------------------------------

http://blog.sina.com.cn/s/blog_5d2e69770102v0ra.html

//---------------------------------------------------------

显式 Intent 调用

1     //创建一个显式的 Intent 对象(方法一:在构造函数中指定)

2      Intent intent = new Intent(Intent_Demo1.this, Intent_Demo1_Result1.class);

3

4      Bundle bundle = new Bundle();

5      bundle.putString("id", strID);

6      intent.putExtras(bundle);

7

8      intent.putExtra("name", "bbb");

9      intent.putExtra("userInfo", new UserInfo(1, "name"));

10      startActivity(intent);

11

12      //创建一个显式的 Intent 对象(方法二:用 setClass 方法)

13      Intent intent = new Intent();

14      Bundle bundle = new Bundle();

15      bundle.putString("id", strID);

16      intent.setClass(Intent_Demo1.this, Intent_Demo1_Result1.class);

17      intent.putExtras(bundle);

18      startActivity(intent);

19

20      //创建一个显式的 Intent 对象(方法三:用 setClass 方法)

21      Intent intent = new Intent();

22      Bundle bundle = new Bundle();

23      bundle.putString("id", strID);

24      intent.setClassName(Intent_Demo1.this, "com.great.activity_intent.Intent_Demo1_Result1");

25      intent.putExtras(bundle);

26      startActivity(intent);

27

28      //创建一个显式的 Intent 对象(方法四:用 setComponent 方法)

29      Intent intent = new Intent();

30      Bundle bundle = new Bundle();

31      bundle.putString("id", strID);

32      //setComponent方法的参数:ComponentName

33      intent.setComponent(new ComponentName(Intent_Demo1.this, Intent_Demo1_Result1.class));

34      intent.putExtras(bundle);

35      startActivity(intent);

Intent隐式跳转 Action

1     //创建一个隐式的 Intent 对象:Action 动作

2

7     Intent intent = new Intent();

8     //设置 Intent 的动作

9     intent.setAction("com.great.activity_intent.Intent_Demo1_Result3");

10     Bundle bundle = new Bundle();

11     bundle.putString("id", strID);

12     intent.putExtras(bundle);

13     startActivity(intent);

AndroidManifest.xml

1    < activity android:name="Intent_Demo1_Result3"

2                   android:label="Intent_Demo1_Result3">

3             < intent-filter>

4                 < action android:name="com.great.activity_intent.Intent_Demo1_Result3" />

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

6             < /intent-filter>

7         < /activity>

Category 类别

1 //创建一个隐式的 Intent 对象:Category 类别

2 Intent intent = new Intent();

3 intent.setAction("com.great.activity_intent.Intent_Demo1_Result33");

4

8 intent.addCategory(Intent.CATEGORY_INFO);

9 intent.addCategory(Intent.CATEGORY_DEFAULT);

10 Bundle bundle = new Bundle();

11 bundle.putString("id", strID);

12 intent.putExtras(bundle);

13 startActivity(intent);

AndroidManifest.xml

< activity android:name="Intent_Demo1_Result2"

android:label="Intent_Demo1_Result2">

< intent-filter>

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

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

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

< /intent-filter>

< /activity>

Date 数据 跳转

1 //创建一个隐式的 Intent 对象,方法四:Date 数据

2 Intent intent = new Intent();

3 Uri uri = Uri.parse("http://www.great.org:8080/folder/subfolder/etc/abc.pdf");

4

5 //注:setData、setDataAndType、setType 这三种方法只能单独使用,不可共用

6 //要么单独以 setData 方法设置 URI

7 //intent.setData(uri);

8 //要么单独以 setDataAndType 方法设置 URI 及 mime type

9 intent.setDataAndType(uri, "text/plain");

10 //要么单独以 setDataAndType 方法设置 Type

11 //intent.setType("text/plain");

12

13

17 Bundle bundle = new Bundle();

18 bundle.putString("id", strID);

19 intent.putExtras(bundle);

20 startActivity(intent);

AndroidManifest.xml

1         < activity android:name="Intent_Demo1_Result2"

2                   android:label="Intent_Demo1_Result2">

3             < intent-filter>

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

5                 < data

6                     android:scheme="http"

7                     android:host="www.great.org"

8                     android:port="8080"

9                     android:pathPattern=".*pdf"

10                     android:mimeType="text/plain"/>

11             < /intent-filter>

12         < /activity>

13

调用系统的的组件

//web浏览器

Uri uri= Uri.parse("http://www.baidu.com:8080/image/a.jpg");

Intent intent = new Intent(Intent.ACTION_VIEW, uri);

startActivity(intent);

//地图(要在 Android 手机上才能测试)

Uri uri = Uri.parse("geo:38.899533,-77.036476");

Intent intent = new Intent(Intent.ACTION_VIEW, uri);

startActivity(intent);

//路径规划

Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat startLng&daddr=endLat endLng&hl=en");

Intent it = new Intent(Intent.ACTION_VIEW, uri);

startActivity(it);

//拨打电话-调用拨号程序

Uri uri = Uri.parse("tel:15980665805");

Intent intent = new Intent(Intent.ACTION_DIAL, uri);

startActivity(intent);

//拨打电话-直接拨打电话

//要使用这个必须在配置文件中加入< uses-permission android:name="android.permission.CALL_PHONE"/>

Uri uri = Uri.parse("tel:15980665805");

Intent intent = new Intent(Intent.ACTION_CALL, uri);

startActivity(intent);

//调用发送短信程序(方法一)

Uri uri = Uri.parse("smsto:15980665805");

Intent intent = new Intent(Intent.ACTION_SENDTO, uri);

intent.putExtra("sms_body", "The SMS text");

startActivity(intent);

//调用发送短信程序(方法二)

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.putExtra("sms_body", "The SMS text");

intent.setType("vnd.android-dir/mms-sms");

startActivity(intent);

//发送彩信

Uri uri = Uri.parse("content://media/external/images/media/23");

Intent intent = new Intent(Intent.ACTION_SEND);

intent.putExtra("sms_body", "some text");

intent.putExtra(Intent.EXTRA_STREAM, uri);

intent.setType("image/png");

startActivity(intent);

//发送Email(方法一)(要在 Android 手机上才能测试)

Uri uri = Uri.parse("mailto:zhangsan@gmail.com");

Intent intent = new Intent(Intent.ACTION_SENDTO, uri);

startActivity(intent);

//发送Email(方法二)(要在 Android 手机上才能测试)

Intent intent = new Intent(Intent.ACTION_SENDTO);

intent.setData(Uri.parse("mailto:zhangsan@gmail.com"));

intent.putExtra(Intent.EXTRA_SUBJECT, "这是标题");

intent.putExtra(Intent.EXTRA_TEXT, "这是内容");

startActivity(intent);

//发送Email(方法三)(要在 Android 手机上才能测试)

Intent intent = new Intent(Intent.ACTION_SEND);

intent.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");

intent.putExtra(Intent.EXTRA_SUBJECT, "这是标题");

intent.putExtra(Intent.EXTRA_TEXT, "这是内容");

intent.setType("text/plain");

//选择一个邮件客户端

startActivity(Intent.createChooser(intent, "Choose Email Client"));

//发送Email(方法四)(要在 Android 手机上才能测试)

Intent intent = new Intent(Intent.ACTION_SEND);

//收件人

String[] tos = {"to1@abc.com", "to2@abc.com"};

//抄送人

String[] ccs = {"cc1@abc.com", "cc2@abc.com"};

//密送人

String[] bcc = {"bcc1@abc.com", "bcc2@abc.com"};

intent.putExtra(Intent.EXTRA_EMAIL, tos);

intent.putExtra(Intent.EXTRA_CC, ccs);

intent.putExtra(Intent.EXTRA_BCC, bcc);

intent.putExtra(Intent.EXTRA_SUBJECT, "这是标题");

intent.putExtra(Intent.EXTRA_TEXT, "这是内容");

intent.setType("message/rfc822");

startActivity(Intent.createChooser(intent, "Choose Email Client"));

//发送Email且发送附件(要在 Android 手机上才能测试)

Intent intent = new Intent(Intent.ACTION_SEND);

intent.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");

intent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mp3/醉红颜.mp3");

intent.setType("audio/mp3");

startActivity(Intent.createChooser(intent, "Choose Email Client"));

//播放媒体文件(android 对中文名的文件支持不好)

Intent intent = new Intent(Intent.ACTION_VIEW);

//Uri uri = Uri.parse("file:///sdcard/zhy.mp3");

Uri uri = Uri.parse("file:///sdcard/a.mp3");

intent.setDataAndType(uri, "audio/mp3");

startActivity(intent);

Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");

Intent intent = new Intent(Intent.ACTION_VIEW, uri);

startActivity(intent);

//音乐选择器

//它使用了Intent.ACTION_GET_CONTENT 和 MIME 类型来查找支持 audio/* 的所有 Data Picker,允许用户选择其中之一

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);

intent.setType("audio/*");

//Intent.createChooser:应用选择器,这个方法创建一个 ACTION_CHOOSER Intent

startActivity(Intent.createChooser(intent, "选择音乐"));

Intent intent1 = new Intent(Intent.ACTION_GET_CONTENT);

intent1.setType("audio/*");

Intent intent2 = new Intent(Intent.ACTION_CHOOSER);

intent2.putExtra(Intent.EXTRA_INTENT, intent1);

intent2.putExtra(Intent.EXTRA_TITLE, "aaaa");

startActivity(intent2);

//                //设置壁纸

//                Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);

//                startActivity(Intent.createChooser(intent, "设置壁纸"));

//卸载APK

//fromParts方法

//参数1:URI 的 scheme

//参数2:包路径

//参数3:

Uri uri = Uri.fromParts("package", "com.great.activity_intent", null);

Intent intent = new Intent(Intent.ACTION_DELETE, uri);

startActivity(intent);

//安装APK(???)

Uri uri = Uri.fromParts("package", "com.great.activity_intent", null);

Intent intent = new Intent(Intent.ACTION_PACKAGE_ADDED, uri);

startActivity(intent);

//调用搜索

Intent intent = new Intent();

intent.setAction(Intent.ACTION_WEB_SEARCH);

intent.putExtra(SearchManager.QUERY, "android");

startActivity(intent);

Activity之间的隐士跳转的更多相关文章

  1. 安卓--使用Intent实现Activity之间传值与跳转

    http://blog.csdn.net/cjjky/article/details/6337447 在一个Android的应用程序中,很少只存在一个Activity,一般都有多个Activity,如 ...

  2. 使用Intent实现Activity之间传值与跳转(转)

    转:http://blog.csdn.net/cjjky/article/details/6337447 在一个Android的应用程序中,很少只存在一个Activity,一般都有多个Activity ...

  3. Android TabActivity与Activity之间的动画跳转(主要Tabhost中跳转出来的动画效果解决)

    首先,要说的是ActivityA到ActivityB的切换这个相对简单,只要overridePendingTransition(In,out). 这里不就说了.但是这里要说名的ActivityA不能T ...

  4. Android之Activity之间跳转

    本人自学Android,想到什么就写点什么.主要是怕忘了,哈哈~请观者不要建议~ 今天写点Android窗口之间的跳转以及自己理解: 1.Android中窗口之间的跳转,就是Activity之间的跳转 ...

  5. Android:Activity之间跳转和参数传递

    一个activity就好比一个网页,此文章讲解怎样创建一个activity并且实现跳转! 一.学习创建Activity 1.新建一个java类,右击src目录,选择new-->class,新的a ...

  6. 实现android activity之间的跳转

    android程序一般不会只有一个activity,会碰到activity之间的跳转.以下是使用Intent做应用程序内部的activity做跳转.比如,应用程序第一个activity是: 点击“下一 ...

  7. 杂记之activity之间的跳转

    代码结构图 manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xml ...

  8. android入门:activity之间跳转,并且回传参数

    介绍:         两个activity进行跳转,在跳转过程中,将message由MainActivity传递到secondActivity,并且当secondActivity退回至MainAct ...

  9. Android 写一个Activity之间来回跳转的全局工具类(主要是想实现代码的复用)

    废话不多说了,直接上代码,相信大家都能看得懂的. 一.主要工具类 package com.yw.chat.utils; import android.app.Activity; import andr ...

随机推荐

  1. 学习任务在继续...css...

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  2. 【APP测试初体验】android测试命令----adb常用命令

    --adb shell 命令adb devices 查看设备adb shell adb shell "ls -al /system/bin" >e:\a.txtsample_ ...

  3. 关于git提交、还原使用

    1.本地修改,未提交到本地仓库,想要恢复到修改前 右键这个文件-team-show local hostory -找到某一版本-右键-get Contents 即可恢复到某一版本 2. 命令:git ...

  4. Windows漏洞利用与防护(2015.8)

    Windows平台下的漏洞利用与防护 0x00 概述 在过去的二十几年,Windows作为网络安全的主战场之一,攻于防的较量从未停息过.内存破坏漏洞作为研究的重点之一,经历了很多的发展也沉淀了前辈们许 ...

  5. incredibuild agent service is not running

    incredibuild 不用介绍了,今天因为服务没有启动报错显示为: incredibuild agent service is not running 解决方法为: 在Incredibuild的安 ...

  6. Mac下MySQL的安装与配置

    之前一直用的是阿里云的服务器,在服务器上装了一个MySQL,但是今天发现到期了,而且续费时发现之前的大学生优惠不能用了,可是明明到6月份,大学生才毕业啊,shit!!!所以没办法只能在自己电脑上装一个 ...

  7. Learning C# by Developing Games with Unity 5.x(2nd)

    项目:https://pan.baidu.com/s/1o7IMcZo using UnityEngine; using System.Collections; namespace VoidGame ...

  8. 初始化一个本地GIT仓储

    简单总结下 // 定位到仓储文件夹目录 $ cd /dir // 初始化本地仓储 $ git init ``` 添加本地GIT忽略清单文件.gitignore```// 添加OS X中系统文件.DS_ ...

  9. 关于安装第三方模块和PILLOW

    看廖雪峰老师这一节的教程卡在这里挺久了 在谷歌上了搜了很久,最后根据这个教程上解决了这个问题 http://www.yihaomen.com/article/python/566.htm 觉得自己好蠢 ...

  10. List之根据某个字段在add的时候过滤掉重复的数据

    下面是重写ArrayList,并保证ChooseCars里面alpha字段不重复的例子 public class DistinctList extends ArrayList<ChooseCar ...