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 响应键盘移动图标
  2. ch07 Android 日期与时间对话框
  3. android 根据apk文件路径获取图标
  4. Android TimeLine 时间节点轴的实现
  5. Android时间工具类 本地转UTC,UTC转本地
  6. Android SystemUI状态栏添加图标
  7. 获取未安装的APK图标

随机推荐

  1. Android(安卓)自定义EditText, 增加设置
  2. 真实可行的android 基站定位代码
  3. Android Studio Gradle 添加.so 支持文件
  4. Android项目打包、Eclipse视图和UI控件
  5. Android保存数据几种常用方法解析
  6. Android:ANT打包常见问题简述
  7. Android下玩JNI的新老三种姿势
  8. Android应用程序请求SurfaceFlinger服务
  9. Android个版本适配之7.0
  10. Android UI