博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
android144 360 快捷方式
阅读量:7061 次
发布时间:2019-06-28

本文共 1327 字,大约阅读时间需要 4 分钟。

 

package com.example;

import
android.net.Uri;
import
android.os.Bundle;
import
android.app.Activity;
import
android.content.Intent;
import
android.graphics.Bitmap;
import
android.graphics.BitmapFactory;
import
android.view.Menu;
//
权限:<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
public
class MainActivity
extends
Activity { @Override
protected
void
onCreate(Bundle savedInstanceState) {
super
.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent intent =
new
Intent(); intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"
);
/**
* 1 你想干什么事情 * 2 叫什么名字 * 3 长什么样子
*/
Intent dowhtIntent =
new
Intent();
//
告诉系统哥想打电话
dowhtIntent.setAction(Intent.ACTION_CALL);
//
给谁打电话 dowhtIntent.setData(Uri.parse("tel://110"
));
//
叫什么名字 intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "哈哈"
);
//
长什么样子
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher)); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, dowhtIntent); sendBroadcast(intent); } @Override
public
boolean
onCreateOptionsMenu(Menu menu) {
//
Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return
true
; } }

 

本文转自农夫山泉别墅博客园博客,原文链接:http://www.cnblogs.com/yaowen/p/5143720.html,如需转载请自行联系原作者

你可能感兴趣的文章
EXCHANGE 备忘
查看>>
Windows Server 2003应用宝典
查看>>
DAM2加密狗克隆的具体解决方案
查看>>
教你深入系统的学习linux系统
查看>>
前台向后台隐藏传参数
查看>>
Oracle10g手工创建数据库
查看>>
JS下载文件
查看>>
Nginx 模块常用命令介绍
查看>>
thinkphp5.0框架swoole的使用
查看>>
继上一篇SQL练习题,给出答案
查看>>
慕课网-Java从零打造企业级电商项目实战_项目初始化_项目结构
查看>>
Esper学习笔记二:进程模型
查看>>
Linux环境PHP7.0安装
查看>>
Reactor 响应式编程
查看>>
使用mimipenguin实现从当前 Linux 用户转储登录密码
查看>>
Guitar Pro 6手机版-安卓版-ios版地址
查看>>
CentOS 系统限制普通用户切换到 root 管理员账号
查看>>
npm添加淘宝镜像
查看>>
封装 ~继承~多态
查看>>
Dubbo多注册中心和Zookeeper服务的迁移
查看>>