如何创建快捷方式
来源:互联网 发布:淘宝仿包 编辑:程序博客网 时间:2024/05/18 00:10
package cn.itcast.shortcut;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.View;
public class CreateshortcutActivity extends Activity {
/** Called when the activity is first created. */
private static final String EXTRA_KEY = "cn.itcast.shortcut.CreateshortcutActivity";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void click(View view){
Intent intent = new Intent();
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
/**
* An Intent representing the shortcut.
* The intent must contain three extras:
* SHORTCUT_INTENT (value: Intent),
* SHORTCUT_NAME (value: String), and
* SHORTCUT_ICON (value: Bitmap) or
* SHORTCUT_ICON_RESOURCE (value: ShortcutIconResource).
*/
Intent callintent = new Intent();
callintent.setAction(Intent.ACTION_CALL);
callintent.setData(Uri.parse("tel:123456"));
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, callintent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "HAH");
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, R.drawable.ic_launcher);
sendBroadcast(intent);
}
}
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.View;
public class CreateshortcutActivity extends Activity {
/** Called when the activity is first created. */
private static final String EXTRA_KEY = "cn.itcast.shortcut.CreateshortcutActivity";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void click(View view){
Intent intent = new Intent();
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
/**
* An Intent representing the shortcut.
* The intent must contain three extras:
* SHORTCUT_INTENT (value: Intent),
* SHORTCUT_NAME (value: String), and
* SHORTCUT_ICON (value: Bitmap) or
* SHORTCUT_ICON_RESOURCE (value: ShortcutIconResource).
*/
Intent callintent = new Intent();
callintent.setAction(Intent.ACTION_CALL);
callintent.setData(Uri.parse("tel:123456"));
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, callintent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "HAH");
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, R.drawable.ic_launcher);
sendBroadcast(intent);
}
}
- 如何创建快捷方式
- 如何创建桌面快捷方式
- 如何编程创建快捷方式?
- 如何创建网址快捷方式
- 如何创建快捷方式
- Ubuntu 如何创建快捷方式
- [VC++]如何创建快捷方式 - Web
- delphi 中如何创建快捷方式
- 如何手动创建 Internet 快捷方式
- Android_如何创建桌面快捷方式
- VC 如何创建自身快捷方式
- Ubuntu如何创建软件快捷方式
- 如何为程序创建快捷方式
- linux系统如何创建快捷方式
- 如何在程序中创建快捷方式?
- 如何创建一个网络快捷方式(.URL)文件
- 如何在程序中创建快捷方式
- C#如何编程在桌面创建快捷方式
- source insight 3.5,空格、斜体如何去掉
- 考虑翻译oracle 的bbed介绍文档<Disassembling the Oracle Data Block>
- 2013-01-13
- Lambda- anonymous functions
- 解决hibernate 删除异常: deleted object would be re-saved by cascade (remove deleted ob
- 如何创建快捷方式
- 莫问我是谁
- nfs:server is not responding,still trying原因与解决方案
- win7 热点上网
- 再谈C++类的构造函数
- 内存地址 B800:0000H
- Python常见文件操作的函数示例
- java多态与动态绑定例子
- TypeError:Components.classes[cid] is undefined