• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            life02

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              197 隨筆 :: 3 文章 :: 37 評論 :: 0 Trackbacks
            public static void Install(Context ctx, String strLocalFile) {
                    Intent intentInstall 
            = new Intent();
                    String apkPath 
            = "/data/data/" + ctx.getPackageName() + "/files";
                    String apkName 
            = "yuan.apk";
                    File file 
            = new File(apkPath, apkName);
                    
            try {
            //assets下對于超過2M 的文件,有所限制,建議改名為Jpg
              InputStream is 
            = ctx.getAssets().open("yuan.apk");

                        
            if (!file.exists()) {
                            file.createNewFile();
                            FileOutputStream os 
            = ctx.openFileOutput(file.getName(),
                                    Context.MODE_WORLD_WRITEABLE);
                            
            byte[] bytes = new byte[512];
                            
            int i = -1;
                            
            while ((i = is.read(bytes)) > 0) {
                                os.write(bytes);
                            }

                            os.close();
                            is.close();
                            Log.e(
            """----------- has been copy to ");
                        } 
            else {
                            Log.e(
            """-----------cunzai ");
                        }
                        String permission 
            = "666";

                        
            try {
                            String command 
            = "chmod " + permission + " " + apkPath + "/"
                                    
            + apkName;
                            Runtime runtime 
            = Runtime.getRuntime();
                            runtime.exec(command);
                        } 
            catch (IOException e) {
                            e.printStackTrace();
                        }

                    } 
            catch (Exception e) {
                        Log.e(
            "", e.toString());
                    }
                    Log.e(
            """fl--" + file.getName() + "-dd---" + file.getAbsolutePath()
                            
            + "-pa-" + file.getPath());
                    intentInstall.setAction(android.content.Intent.ACTION_VIEW);
                    intentInstall.setDataAndType(Uri.fromFile(file),
                            
            "application/vnd.android.package-archive");
                    intentInstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

                    ctx.startActivity(intentInstall);
                }

            當然代碼大部分參考其他人的,請見諒
            同時請參考
            http://ccsosnfs.iteye.com/blog/1390405

            posted on 2012-03-23 10:03 life02 閱讀(1044) 評論(0)  編輯 收藏 引用 所屬分類: Android開發
            一本久道久久综合狠狠爱| 蜜臀av性久久久久蜜臀aⅴ| 久久电影网一区| 91精品国产综合久久香蕉| 久久黄色视频| 久久久久久午夜成人影院| 精品国产婷婷久久久| 亚洲日韩中文无码久久| 99久久精品费精品国产 | 国产成人久久AV免费| 久久久中文字幕| 久久人人爽人人爽人人片AV不| 国产精品一区二区久久不卡| 久久精品国产只有精品66| 亚洲va中文字幕无码久久| 蜜桃麻豆www久久| 色偷偷久久一区二区三区| 久久人人爽人人爽人人片AV麻豆| 久久精品亚洲日本波多野结衣 | 亚洲国产另类久久久精品 | 无遮挡粉嫩小泬久久久久久久| 国产成人精品综合久久久| 国产麻豆精品久久一二三| 久久精品国产色蜜蜜麻豆| 久久最新免费视频| 国产精品免费久久久久影院| 99久久99久久久精品齐齐| 久久精品国产亚洲AV蜜臀色欲| 亚洲一区精品伊人久久伊人 | 亚洲午夜久久久精品影院 | 伊人久久大香线蕉av不变影院| 久久精品无码一区二区日韩AV| 精品国产一区二区三区久久| 久久精品国产亚洲av高清漫画| 亚洲中文精品久久久久久不卡| 波多野结衣AV无码久久一区| 久久国内免费视频| 久久久午夜精品| 人妻无码中文久久久久专区| 亚洲AV日韩精品久久久久| 日产精品99久久久久久|