You might try just using java.io.File, which works well for me: File file = new File("/whatever/path/to/file.txt"); try { InputStream in = new FileInputStream(file);
... } catch(Exception ex) { ... } I've noticed in the documentation that openFileInput() is supposed to be what you use, but I haven't determined if the above is not okay, and if not, why not. I'm doing this in several places, and it has never caused a problem. On Dec 10, 9:41 am, "Chandrakar Aravind-rqj386" <[EMAIL PROTECTED]> wrote: > Hi Mark, > > Thanks for reply, is there any methods to read non-local file (file > present outside my application specific area). > > Arvind > > -----Original Message----- > From: android-developers@googlegroups.com > > [mailto:[EMAIL PROTECTED] On Behalf Of Mark Murphy > Sent: Wednesday, December 10, 2008 7:52 PM > To: android-developers@googlegroups.com > Subject: [android-developers] Re: Getting error when trying to read file > : java.lang.IllegalArgumentException: File /data/testing.txt contains a > path separator > > Chandrakar Aravind-rqj386 wrote: > > I am trying to read non-local txt file, but I am getting error: > > > java.lang.IllegalArgumentException: File /data/testing.txt > > contains a path separator > > You probably don't have a file at /data/testing.txt. > > > My code is like that: > > > FileInputStream _orifile_ = > > openFileInput("/data//_samplefile_._txt_"); > > openFileInput() accepts relative paths only. No leading slashes are > allowed. openFileInput() represents files stored in an > application-specific storage area. getFilesDir() will tell you where > this is, IIRC. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 1.9 Available! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---