how to use asset folder? /data/data

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

how to use asset folder? /data/data

Postby pzoli » Mon Jan 11, 2010 4:59 pm

I would like attach some file (sh scripts) in apk package with eclipse and after I would like access that files from main java program. I have read some documents and they said that I put in the assets/raw folder and access on phone from /data/data/package.name/ but this folder is empty.
How to work the assets folder?
pzoli
Freshman
Freshman
 
Posts: 6
Joined: Mon Oct 19, 2009 6:42 am

Top

Postby mrco » Fri Jan 15, 2010 11:38 am

You can use assets with AssetManager:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. InputStream myFile= context.getAssets().open("my_file.bin")
Parsed in 0.029 seconds, using GeSHi 1.0.8.4
mrco
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Jan 15, 2010 11:31 am
Location: 2V Software

Postby pzoli » Fri Jan 15, 2010 12:54 pm

I do want to reach from java. I would like reach from native C code. So where find the compressed apk files on file system?
pzoli
Freshman
Freshman
 
Posts: 6
Joined: Mon Oct 19, 2009 6:42 am

Postby StaryLiu » Wed Jan 27, 2010 9:47 am

Try this :

this.getFilesDir()

it return a file which path is : /data/data/PackageName/files

you can put something u want to save at this file path.
Fox, you'll know who am I.
E-mail : 179715162@qq.com
User avatar
StaryLiu
Freshman
Freshman
 
Posts: 7
Joined: Mon Dec 28, 2009 6:54 am
Location: ShenZhen,China

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 4 guests