hi,
     i have got the answer to this problem if anybody facing the same
problem can refer the code as follows ..


InputStream ins = getResources().openRawResource(R.raw.my_db_file);
int size = ins.available();
// Read the entire resource into a local byte buffer.
byte[] buffer = new byte[size];
ins.read(buffer);
ins.close();


FileOutputStream fos = new FileOutputStream("mycopy.db");
fos.write(buffer);
fos.close();



On Jun 2, 5:20 pm, Sam <csgo...@gmail.com> wrote:
> hi, I am having an db file in res/raw/folder iam calling
> Resources.openRawResource() with the file name as R.raw.FileName and i
> get an input stream but i having an another db file in device i want
> to copy the contents of that db to the device db i am using
> BufferedInputStream bi = new BufferedInputStream(is); and
> FileOutPutStream but i get an exception that database file is
> corrupted ...any hints how to proceed further . i read the file using
> File and FileInputStream and the path as /res/raw/fileName ... but
> that also doesnt works ... Thnx in advance
--~--~---------~--~----~------------~-------~--~----~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to