Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/214.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android中的临时文件夹_Android - Fatal编程技术网

android中的临时文件夹

android中的临时文件夹,android,Android,我将C++库代码移植到Android(最初是为Linux编写的)。 该库是由java应用程序构建和使用的 在前面的linux代码中,库用于在系统的/tmp文件夹中创建和更新日志文件。。。但不幸的是,android中没有这样的临时目录 由于一些原因,我似乎无法使用应用程序缓存保存文件 1. User need to view the file after exiting the app 2. The library need to be reused by different applicati

我将C++库代码移植到Android(最初是为Linux编写的)。 该库是由java应用程序构建和使用的

在前面的linux代码中,库用于在系统的/tmp文件夹中创建和更新日志文件。。。但不幸的是,android中没有这样的临时目录

由于一些原因,我似乎无法使用应用程序缓存保存文件

1. User need to view the file after exiting the app

2. The library need to be reused by different applications in future. 

3. The log file is created by the native library(and not the java app)
(如果我的部分/全部理解错误,请纠正我)

我还发现大多数目录在默认设置下都是写保护的

我如何解决这个问题,而不“扎根”操作系统?
请帮忙

修改C/C++代码以使用Java代码提供的目录。让Java代码传入您在
环境下创建的某个子目录。getExternalStorageDirectory()

修改C/C++代码以使用Java代码提供的目录。将Java代码传递到您在
环境下创建的某个子目录中。getExternalStorageDirectory()

@Dhanesh:没有满足您的条件的“应用程序自己的缓存”#1。不过,欢迎您在外部存储上创建一个以您的应用程序命名的目录。感谢您的澄清。。不过,还有一个问题,如果我在公共目录中没有写权限怎么办。。(我可以不使用“根目录”来完成吗?@Dhanesh:没有“应用程序自己的缓存”满足您的条件#1。不过,欢迎您在外部存储上创建一个以您的应用程序命名的目录。感谢您的澄清。。不过,还有一个问题,如果我在公共目录中没有写权限怎么办。。(我可以不用“根”来做吗?)?