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> */

更多相关文章

  1. android spinner 选中后显示字体的颜色设置
  2. Android(安卓)响应键盘移动图标
  3. Android(安卓)P Android.dp添加逻辑判断
  4. android 开机启动服务
  5. 解决android.os.DeadObjectException问题
  6. Android(安卓)fragment在xml中使用没添加ID
  7. Android——Notifications笔记
  8. Android(安卓)-- EditText插入表情
  9. Android(安卓)Studio3.0 Error:Execution failed for task ':app

随机推荐

  1. (一)Android的内存管理机制
  2. Android(安卓)wifi连接
  3. Android Shader类简介之渲染图像示例
  4. Android 浏览器CSS 居中
  5. 推荐文章1
  6. Android之解析Json数据
  7. Android 项目接入Flutter
  8. Android Studio NDk调试(基于gradle-expe
  9. Android 4.0为Launcher主界面所有应用程
  10. 72、android状态栏一体化,状态栏改变颜色