Delete file after sharing via intent

前端 未结 4 779
轮回少年
轮回少年 2021-01-17 12:13

I\'m trying to delete a temporary file after sharing it via android\'s Intent.ACTION_SEND feature. Right now I am starting the activity for a result and in OnActivityResult,

4条回答
  •  囚心锁ツ
    2021-01-17 12:52

    I have managed to get it to work with:

    File tbd = new File(sharePath);
    tbd.deleteOnExit();
    

    This seems to delete the file when the activity closes.

提交回复
热议问题