【问题标题】:Android Intent Share File not found未找到 Android 意向共享文件
【发布时间】:2014-03-21 23:16:43
【问题描述】:

您好,我正在尝试共享文件,但在上传到 DropBox 或 GoogleDrive 等时...我收到一条消息,指出找不到文件。感谢您的帮助

invia.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        shareIt();
        }

        private Intent shareIt() {

            Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
            shareIntent.setType("*/*");
            shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
            Uri uri = Uri.parse("/data/data/"+getPackageName()+"/databases/Mydb.db");
            shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
            startActivity(Intent.createChooser(shareIntent, "Share via"));
            return shareIntent;
        }
     });
}

【问题讨论】:

    标签: java android file share


    【解决方案1】:

    接收应用程序需要访问 Uri 指向的数据的权限。 Android 开发者网站有两种推荐方式:Send Binary Content

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-27
      相关资源
      最近更新 更多