zoukankan      html  css  js  c++  java
  • 文件存储到getfilesdir和getcache中的解析问题,原来是权限问题

    代码如下:

     public static void LauchInstall(String FilePathName, Context context)
            {
                    chmod("777", FilePathName);
                    Intent intent = new Intent(Intent.ACTION_VIEW);  
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.setDataAndType(Uri.fromFile(new File(FilePathName)), "application/vnd.android.package-archive");  
                    context.startActivity(intent);                   
            }
            
            //修改apk权限
            public static void chmod(String permission, String path)
            {
                    try
                            {
                                    String command         = "chmod " + permission + " " + path;
                                    Runtime runtime = Runtime.getRuntime();
                                    runtime.exec(command);
                            }
                            catch (IOException e)
                            {
                                    e.printStackTrace();
                            }
            }

    参考地址:http://www.devdiv.com/thread-72452-1-1.html

  • 相关阅读:
    10.30 afternoon
    10.29 afternoon
    10.29 morning

    10.27 noip模拟试题
    codevs 3052 多米诺 二分图匹配
    poj 1849 Two
    10.26 noip模拟试题
    10.25 noip模拟试题
    .NET Core EF 版本问题
  • 原文地址:https://www.cnblogs.com/canphp/p/2759051.html
Copyright © 2011-2022 走看看