I read and write files using normal I/O. Hope it continues to work...
I get the base path with
new File( activity.getDir("data", Context.MODE_PRIVATE), name);
Then use it for FileReader, FileWriter and RandomAccessFile.
For assets I use
AssetManager assetManager = activity.getResources().getAssets();
return new InputStreamReader(assetManager.open(path));
On Apr 8, 4:40 am, Kornelius Tuggerson <[EMAIL PROTECTED]>
wrote:
> Do you use java.io.File? If you do that is the reason why its not
> working. You need to use the hooks provided by android for file
> access. To get an inputstream from a file you need to use
> Context.openFileOutput("NameOfFile") This isn't as easy as it looks
> since there are restrictions on which files your app can access, but
> it should work if you put a file into your app's data directory.
>
> If you put the file into your apps res/raw directory accessing it is
> easier. You can use activity.getResources().openRawResource
> (R.raw.mydatafile).
>
> For an example of the second approach take a look at the constructor
> of GeocastContainer in my ADC
> entry:http://code.google.com/p/android-geocast/source/browse/trunk/src/org/...
>
> On Apr 7, 1:58 pm, siddhusingh <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > If the emulator generates a file at
> > /data/data/net.mobilefight.trackbuilder/files/test1_track
> > The file name is : test1_track
> > How to open this file.
> > simple Java IO is throwing FileNotFoundException.
> > Any idea on this.
> > Cheers,
> > Sid
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Android Challenge" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-challenge?hl=en
-~----------~----~----~----~------~----~------~--~---