Hi Yousuf, Thank you very much for the answer. However, I don't know in which directory i should put the file? I don't want to save the file from my application - it should just be there when the application is installed. I don't think I can access this file with the context.openFileInput() method? Or am I wrong?
//Kaloer On 15 Dec., 16:44, Yousuf Syed <yousuf.syed....@gmail.com> wrote: > Hi, > > You cannot use the regular java IO for res/raw. folder. > only if you are using /sd/card you can use regular java.io > > here is some code that might help you > > FileInputStream fin = context.openFileInput("sitestore"); > InputStreamReader br = new InputStreamReader(fin); > String readString = ""; > int i; > while((i = br.read()) != -1){ > inputBuffer = (char)i; > readString = readString + inputBuffer; > } > > FileOutputStream fOut = context.openFileOutput("sitestore", > context.MODE_WORLD_READABLE); > OutputStreamWriter bw = new OutputStreamWriter(fOut); > > write the code for writting to file here........... > > Regards, > > Yousuf. > > On Mon, Dec 14, 2009 at 4:03 PM, kaloer <mkal...@gmail.com> wrote: > > Hi, > > > I have a problem when I'm trying to read a file from the res/raw > > folder. When I get the file as an InputStream and try reading it line > > for line with a BufferedReader, I get an IOException when I'm calling > > the br.readLine(). I do no get any additional information in the > > exception. > > Are there anything wrong with this code: > > > private void readFile(InputStream mFile) { > > DataInputStream in = new DataInputStream(mFile); > > BufferedReader br = new BufferedReader(new > > InputStreamReader(in)); > > String strLine; > > while ((strLine = br.readLine()) != null) { > > Log.i("line", strLine); > > } > > in.close(); > > } > > > Thank you very much! > > > //Kaloer > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Beginners" group. > > To post to this group, send email to android-beginners@googlegroups.com > > To unsubscribe from this group, send email to > > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en