0

How to make folder and files that consists of database in .TXT and .XML appear after installation?

I know it was silly question, but I am creating an offline application using SQLite Database. If user submits the data from apps (e.g: insert to do list, create purchase order), the data will be saved and then TXT file is generated.

This .txt has role as database. The apps will get new data from .txt they recieve via email / cable data and upload .txt users generate to email. This feature is really important, so how to make those files appear in file directory? They have to be seen in order to do so.

Beside that, when I installed my apps I cant find my package folder installed. Though I did install my application from file explorer. I know that I can do it with USB Driver, but my PC couldnt update USBDriver to the phone since it said that my current one was newer. So I had to install it using package installer in my files.

I am very new in learning Android, so I hope you wouldn't mind to tell me what I need to do in my code.. Thanks.

my related previous question: Cant generate folders contains Offline Database after Android APK installation

Community
  • 1
  • 1
  • http://stackoverflow.com/questions/2885173/java-how-to-create-and-write-to-a-file – Anton Savin Aug 26 '14 at 08:19
  • I could generate .TXT files. but it couldnt be seen after installation, it only worked in emulator not in my phone.. – user3851513 Aug 26 '14 at 08:22
  • Where are you trying write them to (the path)? Please update your post with this information. You should use [getFilesDir()](http://developer.android.com/reference/android/content/Context.html#getFilesDir()) to obtain a path you can write to. – Anton Savin Aug 26 '14 at 08:33
  • private static String DB_PATH = "/data/data/MY_PACKAGE/databases/"; where did it lead me to? I searched my package name and/or folders, but not found – user3851513 Aug 26 '14 at 09:03
  • How do you know the files are not written there? This path is private to your application and cannot be seen by any other app, like file manager. If you want to write to some public place, write to `/sdcard/YourAppName` (create that directory first) – Anton Savin Aug 26 '14 at 09:11
  • well, what if users don't have SD card? I think it would be safe to save it in My Files (Storage/emulated/0) which is in samsung device. Btw, if I follow your guide it should be: "/sdcard/data/MY_PACKAGE/databases/ .. did i do it right? – user3851513 Aug 26 '14 at 09:26

0 Answers0