FILENOTFOUND exception when trying to write SQLITE db

by Behr Apps » Tue, 31 Aug 2010 04:50:29 GMT

Sponsored Links
 I am using the code below to read in a SQLITE db file from a website
and then output it to the apps data/databases folder.  I did something
similar to this in another app, the only difference is that instead of
the web, it read the .db file from the assets folder and that worked
just fine.  The problem I am having here is I get a filenotfound
exception after creating the outputstream.  I checked the DDMS while
the app was running and see there is no /data/data/<package>/databases
folder like with my other app so I don't know if that is the issue.  I
also tried to use the file name with a File class and perform the make
dir method but that did not create it either.  Is there something I am
missing in my manifest to let Android know that I want to use

        InputStream myInput;
          try {
            URL updateURL = new
                URL(DB_URL + dbName);
              URLConnection conn = updateURL.openConnection();
              myInput = conn.getInputStream();

                  String outFileName = DB_PATH + dbName;

                  OutputStream myOutput = new FileOutputStream(outFileName);

                  byte[] buffer = new byte[1024];
                  int length;

                  while ((length =>0){
                    myOutput.write(buffer, 0, length);


Other Threads

1. Great Android Tips Article

This should be required reading to any new Android user.

-John Coryat


2. streaming issue with mediaplayer on android 2.0

I have an app that streams mp3's from a server, works fine on 1.5 and
lower. But on the droid, for certain songs the mediaplayer buffers to
like over 50% but onPrepared() is never called. These same songs work
fine on 1.5 or on a 2.0 emulator but for some reason they just hang on
the actual droid phone. No mediaplayer errors are thrown but if i call
stop or reset it while it is{*filter*} like this, it throws this,

12-18 19:14:05.230: ERROR/MediaPlayer(15718): stop called in state 4
12-18 19:14:05.230: ERROR/MediaPlayer(15718): error (-38, 0)
12-18 19:14:05.238: ERROR/PlayerDriver(987): Command (6) was cancelled

it is only for certain files (yes they are all mp3s) and only on the
droid. Anyone have any ideas why these songs would hang? I already
checked the http headers and they are correct. Thanks for any help, it
will be greatly appreciated.


3. How to run unit tests for samples.

4. Android Market - SharedPreferences

5. SDK running OK with Linux/Eclipse 64 bits ?

6. How to highlight the number and URL in page displayed

7. Trackball Highlight for Header in ListView