package com.sada.src.WiWeb;
import com.wistron.src.WiWeb.R;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
public class WiWebserviceActivity extends Activity {
private final String ACTION_ADD_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Parcelable icon = Intent.ShortcutIconResource.fromContext(this,R.drawable.eduicon);
String name = "website";
Uri websiteUri = Uri.parse("http://demo.eee-t.com/exp_cz.aspx");
addShortcut(icon, name, websiteUri);
}
/*
* 在桌面添加快捷方式
*
* @param icon 快捷方式图标
*
* @param name 快捷方式名称
*
* @param uri 快捷方式的intent Uri
*/
public void addShortcut(Parcelable icon, String name, Uri uri) {
Intent intentAddShortcut = new Intent(ACTION_ADD_SHORTCUT);
// 不允许重复创建
intentAddShortcut.putExtra("duplicate", false);
// 添加名称
intentAddShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
// 添加图标
intentAddShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
// 设置Launcher的Uri数据
Intent intentLauncher = new Intent();
intentLauncher.setAction("android.intent.action.VIEW");
intentLauncher.setData(uri);
// 添加快捷方式的启动方法
intentAddShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intentLauncher);
sendBroadcast(intentAddShortcut);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Webserviceapk.rar (26个子文件)
Webserviceapk
AndroidManifest.xml 800B
res
layout
main.xml 248B
drawable-ldpi
eduicon.png 3KB
icon.png 2KB
drawable-mdpi
eduicon.png 3KB
icon.png 3KB
drawable-hdpi
eduicon.png 3KB
icon.png 4KB
drawable-xhdpi
eduicon.png 3KB
values
strings.xml 114B
proguard.cfg 1KB
src
com
sada
src
WiWeb
WiWebserviceActivity.java 2KB
bin
classes
com
wistron
src
WiWeb
BuildConfig.class 351B
R.class 507B
R$layout.class 403B
R$attr.class 349B
R$string.class 407B
R$drawable.class 440B
sada
src
WiWeb
WiWebserviceActivity.class 2KB
AndroidManifest.xml 800B
res
jarlist.cache 119B
.classpath 380B
assets
project.properties 563B
.project 849B
gen
com
wistron
src
WiWeb
R.java 645B
BuildConfig.java 163B
共 26 条
- 1
资源评论
- 萤火架构2012-08-14测试一下还是可以的
sada09
- 粉丝: 42
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功