欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android實(shí)現(xiàn)用代碼簡(jiǎn)單安裝和卸載APK的方法

 更新時(shí)間:2016年08月13日 11:51:15   作者:llyofdream  
這篇文章主要介紹了Android實(shí)現(xiàn)用代碼簡(jiǎn)單安裝和卸載APK的方法,涉及Android針對(duì)APK文件及package的相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了Android實(shí)現(xiàn)用代碼簡(jiǎn)單安裝和卸載APK的方法。分享給大家供大家參考,具體如下:

public class TestInstallAPK extends Activity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 // TODO Auto-generated method stub
 super.onCreate(savedInstanceState);
 // this.unInstallFile();
 installFile();
 }
 /**
 * install APK code
 */
 private void installFile(){
 Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  intent.setAction(android.content.Intent.ACTION_VIEW);
//  String type = getMIMEType(f);
//  intent.setDataAndType(Uri.fromFile(f), type);
 intent.setDataAndType(Uri.parse("file://" + "/sdcard/Android_gc.apk"),
  "application/vnd.android.package-archive");
 this.startActivity(intent);
 }
 /**
 * uninstall APK code
 */
 private void unInstallFile(){
 Uri uri=Uri.parse("package:com.gameclient");
 Intent intent = new Intent(Intent.ACTION_DELETE,uri);
 this.startActivity(intent);
 }
}

更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android開(kāi)發(fā)入門(mén)與進(jìn)階教程》、《Android調(diào)試技巧與常見(jiàn)問(wèn)題解決方法匯總》、《Android多媒體操作技巧匯總(音頻,視頻,錄音等)》、《Android基本組件用法總結(jié)》、《Android視圖View技巧總結(jié)》、《Android布局layout技巧總結(jié)》及《Android控件用法總結(jié)

希望本文所述對(duì)大家Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論