Android 添加快捷方式
来源:互联网 发布:淘宝美工的简历 编辑:程序博客网 时间:2024/05/16 07:37
package com.king.android.speical;
import com.king.android.R;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
/**
* 描述:快捷方式
* 作者:Andy.Liu
* 时间: 2012-7-16 下午11:59:07
**/
public class ShortCutActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent addShortCut;
if(getIntent().getAction().equals(Intent.ACTION_CREATE_SHORTCUT)){
addShortCut = new Intent();
addShortCut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, "发送邮件");
//构建快捷方式中专门的图标
Parcelable icon = Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher);
//添加快捷方式图标
addShortCut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
//构建快捷方式执行的intent
Intent mailto = new Intent(Intent.ACTION_SENDTO,Uri.parse("mailto:xxx@xxx.com"));
//添加快捷方式的intent
addShortCut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, mailto);
//正常
setResult(RESULT_OK, addShortCut);
}else{
//取消
setResult(RESULT_CANCELED);
}
finish();
}
}
/** 注意需要注册快捷方式
<activity
android:label="@string/app_name"
android:name=".speical.WidgetActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.CREATE_LIVE_FOLDER"/>
</intent-filter>
</activity>
*/
0 0
- android桌面添加快捷方式
- Android添加桌面快捷方式
- android添加删除快捷方式
- android 创建添加快捷方式
- android应用添加快捷方式
- android应用添加快捷方式
- android添加快捷方式
- Android添加快捷方式
- Android 添加快捷方式
- Android添加快捷方式
- android 添加桌面快捷方式
- Android代码添加快捷方式与删除快捷方式
- android 添加和删除快捷方式
- Android 向桌面添加快捷方式
- android添加删除桌面快捷方式
- Android 添加和删除快捷方式
- 【Android】添加删除桌面快捷方式
- Android 向桌面添加快捷方式
- Intent
- SharePreference操作数据库
- Android文件读写,保存数据
- Android传感器使用
- Android语音识别功能使用
- Android 添加快捷方式
- 前端开发面试题
- android 创建实时文件夹
- Source Code Collection for Reproducible Research
- Android Widget桌面组件创建
- Android 通信的桥梁 Intent
- Android 内存泄漏总结
- Android 中Service组件
- Android Serivce 高级篇AIDL讲解