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
databases?

        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 = myInput.read(buffer))>0){
                    myOutput.write(buffer, 0, length);
                  }

--



Other Threads

1. how to use a content provider from other applications

You don't do anything special to use it from another app, just use
ContentResolver to perform a query or whatever operation you want on the
appropriate URI.  This will use the URI's authority to find the other app's
content provider, launch it, perform the operation on it, and return the
result.

On Tue, Jan 20, 2009 at 11:02 PM, sunitna...@gmail.com <sunitna...@gmail.com



> 

2. Can not access to the system properties store?

There are a number of things that settings does that normal apps can't, and
this is probably one of them.  We generally consider settings to be part of
the system, not an application.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~

3. how do I add zoom and pan features to my view easily?

4. HttpURLConnection Timeout does not work

5. TimeZone Data from GPS coordinates

6. Launching customized destop application at Android Boot

7. About using MAP Api