软件的分享、卸载、详细信息、运行的代码实现
2016-06-04 16:14
911 查看
LinearLayout ll_uninstall = (LinearLayout) contentView.findViewById(R.id.ll_uninstall); LinearLayout ll_share = (LinearLayout) contentView.findViewById(R.id.ll_share); LinearLayout ll_start = (LinearLayout) contentView.findViewById(R.id.ll_start); LinearLayout ll_detail = (LinearLayout) contentView.findViewById(R.id.ll_detail); ll_uninstall.setOnClickListener(AppManagerActivity.this); ll_share.setOnClickListener(AppManagerActivity.this); ll_start.setOnClickListener(AppManagerActivity.this); ll_detail.setOnClickListener(AppManagerActivity.this);
public void onClick(View v) { switch (v.getId()) { //分享 case R.id.ll_share: Intent share_localIntent = new Intent("android.intent.action.SEND"); share_localIntent.setType("text/plain"); share_localIntent.putExtra("android.intent.extra.SUBJECT", "f分享"); share_localIntent.putExtra("android.intent.extra.TEXT", "Hi!推荐您使用软件:" + clickAppInfo.getApkName()+"下载地址:"+"https://play.google.com/store/apps/details?id="+clickAppInfo.getApkPackageName()); this.startActivity(Intent.createChooser(share_localIntent, "分享")); popupWindowDismiss(); break; //运行 case R.id.ll_start: Intent start_localIntent = this.getPackageManager().getLaunchIntentForPackage(clickAppInfo.getApkPackageName()); this.startActivity(start_localIntent); popupWindowDismiss(); break; //卸载 case R.id.ll_uninstall: Intent uninstall_localIntent = new Intent("android.intent.action.DELETE", Uri.parse("package:" + clickAppInfo.getApkPackageName())); startActivity(uninstall_localIntent); popupWindowDismiss(); break; //详情 case R.id.ll_detail: Intent detail_intent = new Intent(); detail_intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); detail_intent.addCategory(Intent.CATEGORY_DEFAULT); detail_intent.setData(Uri.parse("package:" + clickAppInfo.getApkPackageName())); startActivity(detail_intent); break; } }
相关文章推荐
- 【CF 应用开发大赛】IT Share(IT分享网)
- [Android]在代码里运行另一个程序的方法
- 如何隐藏程序的运行
- win运行字符命令
- PowerShell实现动态获取当前脚本运行时消耗的内存
- 在Linux上运行C#的方法
- C#隐式运行CMD命令(隐藏命令窗口)
- C#实现托盘程序并禁止多个应用实例运行的方法
- nodejs教程之环境安装及运行
- 查看 MySQL 已经运行多长时间的方法
- android的编译和运行过程深入分析
- 新版本susymenu树形菜单,请大家指教、分享
- C#判断程序是否是管理员权限运行的方法代码示例
- 使用bat批处理来安装和卸载ASP组件
- javascript实现类似百度分享功能的方法
- JavaScript优化专题之Loading and Execution加载和运行
- 网页上facebook分享功能具体实现
- 在命令行下运行PHP脚本[带参数]的方法
- Linux rpm tar 操作系统下软件的安装与卸载方法
- js网页中的(运行代码)功能实现思路