How to attach .db file with another .apk android - android

i am making dictionary and i have so much data to load. I want that i create a project which first load the dictionary words in database and the after i use this .db file in my 2nd project which is dictionary project.
But i don't know how to get the .db file and copy it and paste it into my assets folder.

Well, yopu cant simply copy any files from one private storage, to another. I suppose you can archive this using different ways, for example:
1) Copy your .db file to SD card by first app, and copy it back to private storage by the second app.
2) You can use ContentProvider to share private data between 2 different applications without moving it on SD card.
You can'not get direct access to assest or any other data folder of different application. Good luck!

You can get resources from other package with PackageManager.getResourcesForApplication() method. Also you can share user id between your apps and sign them with share sertificate. In this case you can even share code base. +#Evos' suggestions.
I think share user id is your choise.
You can find examples and more info in this post and here.

Open Your previous project them open DDMS tab ,then go on path
data--->data---->your project---->databases--->.db file
now select that file and click on top right corner of screen here is a buuton to pull file from device to PC so click on that now a file dialog will appear select location to save file , now ok....this action will save your .db file on your selected location
now you can copy this file and put this file in your new projects assets folder and then use it.

Related

Android : Downloading the HTML file from server and save it into assets folder

I want to host an HTML file on server and once user is registered on the app, i want to get this file downloaded and saved into assets folder of the app on the local device and once i have this file into assets folder, i will display it into a WebView and user should be able to see the contents of that file every time user opens it.
And whenever i update the file on server, i want to display a popup for user to accept it, and once user have accepted it, i want to replace the old HTML file from assets folder with the new one.
And from now onwards, the new file will be downloaded on the local system and every time user wants to access the file, he should be able to access the new one.
I'm not sure if that's possible at all, but would certainly be interested in hearing from anyone that knows anything about such things.
Since I cannot write any files to assets or any raw dir, where it will
be written?
openFileOutput() writes to internal storage.
What will the location of that file be? Where will it be located in
the Android file system ?
The apk is read only and the assets/ folder is not modifiable at
runtime, which sounds like something you may be seeking.
Link Source

Android excel file reading by user selection

Android file reading. I am learning android and a beginner. I wish create an app in which user can can download and excel file into the external storage(I mean accessible internal storage and preferably not SD card). On button click file browser should pop and user can guide to the file. Later reading the file in android. I have seen lot resource folder and asset folder. This is not I want. If anyone have done this please help. Struggling for a quiet long to achieve this. So far using the URI I am able to get the root folder and select the file but not sure how to select the file.

Android - How to create a folder that can't be accessed by user?

I have created a file inside one folder in android and I have encrypted that file. When user clicks "READ" button in my app, the specified file will be decrypted in same folder. but I want the users not to access those files via USB or file manager. How to implement this concept?
Use this
context.getDir(null, Context.MODE_PRIVATE);
In place of
context.getExternalCacheDir()
This will solve your problem.

Save App file to default folder

Well, I tried to search in google and SO, but didn't find much mainly because I am not sure what should be my search word. So, if anybody thinks this question is too generic and should be searched first, please help me providing some useful link.
What I want is, to have two buttons in my App which should download sample.csv and sample.php (I want to attach this file inside my App) file and save it to user directory, preferably in "download" folder or somewhere user can access easily.
I found this page by searching but here they demonstrates saving File on Internal Storage in App's folder only. Now I am confused whether this App's folder is accessible by browsing or not (I can't find my app's folder in my Samsung Note 2).
Another question pops up in my mind is, whether I have to read those sample files and create new file to save, or I can simply put a link and download the sample files I provided (more like HTML link)? Or may be I can just upload those sample files in my web server as zipped and give a link to dload?
Apology for my long email, but I am confused where to start.
Thanks,
You can not access your app's internal directory. However, what you can do is to use InputOutputStream to copy your file from the internal directory to your desired folder, and then delete the file from the app's directory. Try searching for copying files and you'll find multiple links.

i want to display files stored in sdcard on clicking button in my android app. How do i do that?

i want to display files stored in sdcard on clicking button in my android app. How do i do that?
I search a lot for browsing sdcard for files which i can choose for attachment in my android Tab app.
There is a open source project which gives you a complete file picker and can be invoked using intents
https://github.com/iPaulPro/aFileChooser
See this link. its File Chooser example in that you will get current Directory.
Now you have do that like on touch of list item you have to get that doc path and that will useful to send to server or ant other purpose. Make sure if you delete that file from sd card then it will not work .

Categories

Resources