Cant generate folders contains Offline Database after Android APK installation

社会主义新天地 提交于 2020-01-16 00:50:35

问题


I use SQLite as my offline database. After the APK installation, I couldn't find the folders that I made. I want to put the database in device Storage : /storage/emulated/0 (Samsung device where I tested my program).

I already put this in my manifest :

<manifest android:installLocation="preferExternal" />

To install APK, i copied it directly from bin to my phone external storage. Did I miss something?

**notes: I need for users to be able to access files (.TXT and .XML) from device storage, so the folders and files inside shouldn't be hidden.

I'd appreciate your kind reply.. Thanks


回答1:


installLocation="preferExternal" refers to the app installation, not to an eventual database (which I don't see mentioned anywhere in your question, other than in its title).

i copied it directly from bin to my phone external storage. Did I miss something? YES: this is not enough.
You have to install the apk, after copying it - you'll need a file manager to launch it.
OR (better) activate your Debug Options and run the app from the IDE directly onto your phone (you'll need to install the ADB Bridge, aka USB driver, aka ADB Composite Interface).

so the folders and files inside shouldn't be hidden. Every file in the apk is private to your app.
Other than this, your SD Card and then use them from there.
Use Environment.getExternalStorageDirectory() to get the path to your SD Card.

If you need some clarification on databases, please post a specific question about that matter.



来源:https://stackoverflow.com/questions/25499946/cant-generate-folders-contains-offline-database-after-android-apk-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!