Here is the output. No stack trace because nothing is being thrown.
its as if it works perfectly. It writes to the directories its
supposed to and creates the KML file. The DDMS file explorer is
showing it perfectly. It just doesn't create the directories when
pushed to the device:/

10-20 14:54:52.798: INFO/LoginActivity(8925): This is the input
stream /data/data/com.drayagerecorder/databases/LOGGERDB
10-20 14:54:52.838: INFO/LoginActivity(8925): External Storage
Avaliable:true
10-20 14:54:52.838: INFO/LoginActivity(8925): External Storage
Writable:true
10-20 14:54:52.878: INFO/LoginActivity(8925): Directory Created
10-20 14:54:52.938: INFO/LoginActivity(8925): This is the ouput stream
10-20 14:54:52.978: INFO/LoginActivity(8925): Bytes transfered
10-20 14:54:52.978: INFO/LoginActivity(8925): flushed
10-20 14:54:52.988: INFO/LoginActivity(8925): output close
10-20 14:54:53.000: INFO/LoginActivity(8925): input close
10-20 14:54:53.168: DEBUG/LoginActivity(8925): <?xml version="1.0"
encoding="UTF-8"?>
10-20 14:54:53.168: DEBUG/LoginActivity(8925): <kml xmlns="http://
www.opengis.net/kml/2.2">
10-20 14:54:53.168: DEBUG/LoginActivity(8925):   <Document>
10-20 14:54:53.168: DEBUG/LoginActivity(8925): <Style id="truck">
10-20 14:54:53.168: DEBUG/LoginActivity(8925): <IconStyle>
10-20 14:54:53.168: DEBUG/LoginActivity(8925): <color>ff11fdfa</color>
10-20 14:54:53.168: DEBUG/LoginActivity(8925): <scale>1.1</scale>
10-20 14:54:53.168: DEBUG/LoginActivity(8925): <Icon>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
http://maps.google.com/mapfiles/kml/shapes/truck.png
10-20 14:54:53.168: DEBUG/LoginActivity(8925): </Icon>
10-20 14:54:53.168: DEBUG/LoginActivity(8925): </IconStyle>
10-20 14:54:53.168: DEBUG/LoginActivity(8925): </Style>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <name>del</name>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Style
id="yellowLineGreenPoly">
10-20 14:54:53.168: DEBUG/LoginActivity(8925):       <LineStyle>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<color>7f00ffff</color>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <width>4</
width>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):       </LineStyle>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):       <PolyStyle>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<color>7f00ff00</color>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):       </PolyStyle>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Style>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <extrude>0</
extrude>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <tessellate>1</
tessellate>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<altitudeMode>clampToGround</altitudeMode>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:53:55Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.73926,51.3329783</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:53:55Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.7385883,51.3335983</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:53:55Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.7397483,51.3352983</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:53:55Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.73998,51.3356583</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:53:56Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.7435683,51.3368483</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:53:56Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.74363,51.3369383</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:53:56Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.74334,51.33702</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:53:56Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.74232,51.33729</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:53:56Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.7427083,51.33785</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     <Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         <TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<when>2011-10-20T21:54:15Z</when>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </TimeStamp>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):  <styleUrl> #Truck</
styleUrl>        <Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):
<coordinates>-0.12851,51.49998</coordinates>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):         </Point>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):     </Placemark>
10-20 14:54:53.168: DEBUG/LoginActivity(8925):   </Document>
10-20 14:54:53.168: DEBUG/LoginActivity(8925): </kml>
10-20 14:54:53.257: INFO/LoginActivity(8925): External Storage
Avaliable:true
10-20 14:54:53.257: INFO/LoginActivity(8925): External Storage
Writable:true


On Oct 20, 1:54 pm, Kostya Vasilyev <[email protected]> wrote:
> Well, in that case, let's see the logcat stack trace :)
>
> I have code just like this, and it works on real devices, except I'm
> calling it before opening the database, from inside my "db open
> helper"-alike. Wonder if that's what's making the difference.
>
> -- Kostya
>
> 21.10.2011 0:08, Ab Caballero пишет:
>
>
>
>
>
> > Hi, Kostya.
>
> > Hard coding aside (i agree its not the best practice), i have methods
> > verifying that the paths are indeed correct. I'm uncertain why it
> > works in eclipse but not on the device
>
> > On Oct 20, 12:30 pm, Kostya Vasilyev<[email protected]>  wrote:
> >> Don't hard code the paths.
>
> >> For the database path, use context.getDatabasePath
>
> >> For the sdcard, use Environment.getExternalStorageDirectory
>
> >> -- Kostya
>
> >> 2011/10/20 Ab Caballero<[email protected]>
>
> >>> Hi,
> >>> I am attempting tocopya file frominternalstoragelike so:
> >>> void exportDB() throws IOException {
> >>>           InputStream input = new FileInputStream("/data/data/
> >>> com.drayagerecorder/databases/DB");
> >>>           // create directory for backup
> >>>           checkStorage();
> >>>           File dir = new File("/sdcard/DB");
> >>>           dir.mkdir();
> >>>           // Path to the external backup
> >>>           OutputStream output = new FileOutputStream("/sdcard/DB/"+
> >>> currentName +"_db");
> >>>           // transfer bytes from the Input File to the Output File
> >>>           byte[] buffer = new byte[1024];
> >>>           int length;
> >>>           while ((length = input.read(buffer))>0) {
> >>>               output.write(buffer, 0, length);
> >>>           }
> >>> It works in eclipse but does not work on the device. Am i accessing
> >>> theinternalstoragecorrectly? The externalstorageis checked and is
> >>> available
> >>>           output.flush();
> >>>           output.close();
> >>>           input.close();
> >>>          }
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Android Developers" group.
> >>> To post to this group, send email to [email protected]
> >>> To unsubscribe from this group, send email to
> >>> [email protected]
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/android-developers?hl=en
>
> --
> Kostya Vasilyev

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to