【问题标题】:Change attachment name when sharing file to mail将文件共享到邮件时更改附件名称
【发布时间】:2014-03-01 02:20:49
【问题描述】:

我正在使用此代码共享文件:

Uri fileUri = Uri.fromFile(new File(filePath));
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("audio/mp3");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");
shareIntent.putExtra(Intent.EXTRA_TEXT, "body");
shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
startActivity(Intent.createChooser(shareIntent, "Share"));

文件名为:“a123456789cd.mp3”。我无法更改实际文件名,因此我只需将附件中的文件名更改为有意义的名称,例如:“myRecording.mp3”。 那可能吗 ?

感谢您的帮助

【问题讨论】:

    标签: android android-intent android-sharing


    【解决方案1】:

    鉴于 android 如何处理应用程序中的资源,似乎没有简单的解决方法。看到这个答案:Email attachment send by app has different name than file that is sent

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-11
      • 2018-11-15
      • 2019-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-30
      • 1970-01-01
      相关资源
      最近更新 更多