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. Add buttons into the tab

Hi,
        I have created an application that creates tabs dynamically
when i click on a button. I wish to add 2 buttons in each of the tabs
(some what similar to tabs in the browsers). Can you please suggest me
to create them.


Thanking you,
suhas

-- 

2. AlarmManager Daily Service?

I need to run a service each night at midnight. I would like to use
the AlarmManager to do this.

Can you give me some guidance of how to make it work correctly?


alarmManager =
(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,
System.currentTimeMillis(), AlarmManager.INTERNAL_DAY, serviceIntent);


Perhaps I need to use a Calendar object to specify the time?  Thanks
for any help!

-- 

3. please help me i am a beginner

4. Content Provider not updating strings from locale

5. can i use javascript localstorage in html5 in android 1.5 or above with WebView?

6. Animation on element in a custom view

7. WebView Problem