5 返回桌面 Intent的action 和 category 属性
来源:互联网 发布:软件开发精品课程 编辑:程序博客网 时间:2024/05/16 09:32
------------------------------------------main.java--------------------------------
package com.example.mk;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
public class MainActivity extends ActionBarActivity {
//要加final,因为下面的 switch语句的case只能是常量,而不能是变量
private final int PICK_CONTACT = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void getOnClick(View view) {
//创建intent
Intent intent = new Intent();
//设置Intent的Action属性
intent.setAction(Intent.ACTION_MAIN);
//设置Intent的Category属性
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);
}
}
。。。。。。。。。。。。。。。。。。。。。。。main.xml。。。。。。。。。。。。。。。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="返回桌面"
android:onClick="getOnClick"
/>
</LinearLayout>
- 5 返回桌面 Intent的action 和 category 属性
- Intent的Action、Category属性
- 安卓学习笔记--Intent的属性action和category
- android Intent的Action、Category属性
- Intent的属性Action, Category, Extras,Data
- Intent的Action与Category属性以及intent-filter配置
- Intent属性component,action,category
- Intent的Component,Action和Category属性详解-android学习之旅(五十)
- android intent中的action data Category、Extras的重要属性
- Action、Category属性与intent-filter配置
- Intent属性详解二 Action、Category
- Android中Intent的Action、Category属性与intent-filter配置
- 5 读取单个联系人 Intent 的action和type 属性
- Intent的启动和属性(action)
- 关于activity元素的 android.intent.action.MAIN 和 android.intent.category.LAUNCHER
- 关于android.intent.action.MAIN和android.intent.category.LAUNCHER的简单理解
- android.intent.category.LAUNCHER 和 android:name="android.intent.action.MAIN 的作用
- 对于android.intent.action.MAIN和android.intent.category.LAUNCHER的理解
- hdoj 1262 寻找素数对
- 【JavaScript】利用getElementsByTagName与getElementsByName改进原生态兼容IE6标签页
- Disruptor原理浅析
- C++ STL 算法:逆转和旋转
- swing table的使用
- 5 返回桌面 Intent的action 和 category 属性
- Ubuntu 14.04 安装 A卡HD7750 官方闭源 显卡驱动
- NYOJ 78 圈水池( 凸包入门)
- poj 3660Cow Contest(传递闭包)
- LeetCode : Container With Most Water
- UVA-1030-Image Is Everything
- Swing JList使用
- 利用matlab计算Pearson和Spearman相关系数
- Remove Duplicates from Sorted Array