How to delete all temp files which created by createTempFile when exit an App in android?

前端 未结 7 2335
清酒与你
清酒与你 2021-02-07 15:06

I use the following code to create some temp files, and wrapped tem as inputsteam to send to client side.

I understand that the temp files can be deleted automatically b

7条回答
  •  情深已故
    2021-02-07 15:26

    call the deleteOnExit() method!

    Or

    call the delete() method in the onStop() of your activity.

    Edit:

    It might be better if you called delete() in onDestroy() to insure that your code works even if app is destroyed by system.

提交回复
热议问题