Activity中启动其他包里的Activity摘要

  • Explicit Intents have specified a component (via setComponent(ComponentName) or setClass(Context, Class)), which provides the exact class to be run. Often these will not include any other information, simply being a way for an application to launch various internal activities it has as the user interacts with the application.

    显式调用,如果知道明确的模块名称,可以直接用Itent类的setComponent和setClass方法来配置intent,并用startActivity来启动应用;

     

    比如:

    apk中有一个名为 HelloAndroid的Activity, 包路径为com.android.test.HelloAndroid.

    调用如下:
    Intent intent = new Intent();
    intent.setComponent(new ComponentName("com.android.test", "com.android.test.HelloAndroid"));
    startActivity(intent);

     

  • Implicit Intents have not specified a component; instead, they must include enough information for the system to determine which of the available components is best to run for that intent.

    隐式的调用是指让系统给你返回可以打开这个文件的应用程序列表,然后从列表中选取确切的程序来运行。(这个下次再看看,这里没弄)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.yarin.android.FileManager"
      android:versionCode="1"

      android:versionName="1.0">


     应用程序的包命要看  manifest 中的配置。

你可能感兴趣的:(android,application,Class,include,encoding,Components)