Android Intents 开源项目教程
项目的目录结构及介绍
android-intents/
├── app/
│ ├── build/
│ ├── libs/
│ ├── src/
│ │ ├── androidTest/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ ├── com/
│ │ │ │ │ ├── marvinlabs/
│ │ │ │ │ │ ├── android/
│ │ │ │ │ │ │ ├── intents/
│ │ │ │ │ │ │ │ ├── AboutActivity.java
│ │ │ │ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ │ │ │ ├── ...
│ │ │ │ │ │ │ │ └── Intents.java
│ │ │ ├── res/
│ │ │ │ ├── drawable/
│ │ │ │ ├── layout/
│ │ │ │ ├── menu/
│ │ │ │ ├── values/
│ │ │ │ └── ...
│ │ │ └── AndroidManifest.xml
│ │ └── test/
│ ├── build.gradle
│ └── proguard-rules.pro
├── library/
│ ├── build/
│ ├── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ ├── com/
│ │ │ │ │ ├── marvinlabs/
│ │ │ │ │ │ ├── android/
│ │ │ │ │ │ │ ├── intents/
│ │ │ │ │ │ │ │ ├── ...
│ │ │ │ │ │ │ │ └── Intents.java
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ └── proguard-rules.pro
├── build.gradle
├── gradle.properties
├── settings.gradle
└── ...
目录结构介绍
- app/: 包含应用程序的主要代码和资源文件。
- src/main/java/com/marvinlabs/android/intents/: 包含主要的Java代码文件。
- src/main/res/: 包含应用程序的资源文件,如布局、菜单、值等。
- src/main/AndroidManifest.xml: 应用程序的清单文件。
- library/: 包含库项目的代码和资源文件。
- src/main/java/com/marvinlabs/android/intents/: 包含库项目的Java代码文件。
- src/main/AndroidManifest.xml: 库项目的清单文件。
- build.gradle: 项目的构建脚本。
- settings.gradle: 项目的设置文件。
项目的启动文件介绍
MainActivity.java
MainActivity.java
是应用程序的主活动文件,负责启动应用程序的主界面。
package com.marvinlabs.android.intents;
import android.os.Bundle;
import android.app.Activity;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Intents.java
Intents.java
是库项目的主要文件,包含各种意图的定义和处理方法。
package com.marvinlabs.android.intents;
import android.content.Intent;
public class Intents {
public static final String ACTION_VIEW_WEBPAGE = "com.marvinlabs.android.intents.VIEW_WEBPAGE";
public static Intent createViewWebpageIntent(String url) {
Intent intent = new Intent(ACTION_VIEW_WEBPAGE);
intent.setData(Uri.parse(url));
return intent;
}
}
项目的配置文件介绍
AndroidManifest.xml
AndroidManifest.xml
是应用程序和库项目的清单文件,包含应用程序的基本信息和组件声明。
<manifest xmlns:android="http://