手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >android通过代码的形式来实现应用程序的安装与卸载
android通过代码的形式来实现应用程序的安装与卸载
摘要:因为应用程序的安装与卸载模块在android系统中已经写好了,所以我们只需要激活就行了注意:intent.setDataAndType(Ur...

因为应用程序的安装与卸载模块在android系统中已经写好了,所以我们只需要激活就行了

注意:

intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");这一句话中,第一个参数是要安装的apk的路径,第二个参数是apk所对应的类型。可以砸tomcat的安装目录下的conf目录下的web.xml中找到

程序运行截图:

android通过代码的形式来实现应用程序的安装与卸载1

代码实现如下:

1、main.xml

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="安装" android:onClick="install" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="卸载" android:onClick="uninstall" /> </LinearLayout>

【android通过代码的形式来实现应用程序的安装与卸载】相关文章:

android 复制 粘贴 剪切功能应用

Android控件之EditView常用属性及应用方法

android上一个可追踪代码具体到函数某行的日志类

android开发基础教程—打电话发短信

Android 原始资源文件的使用详解

基于Android中实现定时器的3种解决方法

android平台应用GPIO模拟IR控制车载DTV

android中选中菜单的显示跳转和隐式跳转的实例介绍

android之计时器(Chronometer)的使用以及常用的方法

android 进程的优先级

精品推荐
分类导航