[android-developers] Re: Unable to write text file to sdcard on physical G1 device
We resolved the issue, my project is dependent on another project and after keeping the WRITE_EXTERNAL_STORAGE permission in both the projects manifest files solved the issue. Thank you all for helping. Android user. On Oct 15, 12:13 pm, androiduser mobile androiduser.mob...@gmail.com wrote: Hi Mark, we did try these but no luck. We tried with same SD card what I am using. No formatting issue. Thanks, Android user On Oct 15, 10:49 am, Mark Murphy mmur...@commonsware.com wrote: androiduser mobilewrote: File directory = new File (Environment.getExternalStorageDirectory().getPath()+/downloads); Creating paths via concatenation is bad form and prone to error (e.g., duplicate slashes). Use: new File(Environment.getExternalStorageDirectory(), downloads); File file = new File(directory.getPath()+/+filename); See above. if (!file.exists() directory.exists()){ try { file.createNewFile(); } catch (IOException e) { Log.d(TAG,File creation failed for + file); } } Is the SD card on the target device formatted FAT32, or something else? -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print!- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Hi all, I am facing a weird problem now, I have a piece of code which copies the files from assets folder to sdcard/downloads and is working well for me, but when other user is running this code in his system, he is getting Parent directory does not exist exception with file.createNewFile(). We both are using the same android SDK. Can anyone suggest what makes it work differently in different systems? Thanks, Android user. On Sep 17, 12:43 am, tauntz tau...@gmail.com wrote: Applications targeted for 1.0, 1.1 and 1.5 will be able to write to the external storage without any permissions. They will continue to work just like they have till today. http://developer.android.com/sdk/android-1.6.html#api-changes WRITE_EXTERNAL_STORAGE: Allows an application to write to external storage. Applications using API Level 3 and lower will be implicitly granted this permission (and this will be visible to the user); Applications using API Level 4 or higher must explicitly request this permission. Tauno On Thu, Sep 17, 2009 at 10:25 AM, Shrenik Vikam shre...@ruby-solutions.com wrote: WRITE_EXTERNAL_STORAGE is there in 1.6 what abt 1.5 ??? On Sep 10, 12:30 am, androiduser mobile androiduser.mob...@gmail.com wrote: I got it working with a permission change in the manifest file. I added WRITE_EXTERNAL_STORAGE and it worked like a gem :)). On Sep 9, 12:13 pm, Chris Stratton cs07...@gmail.com wrote: On Jul 17, 6:24 pm, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch thesdcardvia adb shell gives me a permission denied message... FYI there's no touch command in the shell or /system/bin and the shell apparently considers permission denied to be a good substitute for [command] not found but you can cat /sdcard/testfile and then ^D- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
androiduser mobile wrote: Hi all, I am facing a weird problem now, I have a piece of code which copies the files from assets folder to sdcard/downloads and is working well for me, but when other user is running this code in his system, he is getting Parent directory does not exist exception with file.createNewFile(). We both are using the same android SDK. Can anyone suggest what makes it work differently in different systems? Perhaps the other user does not have an /sdcard/downloads/ directory, either because: 1. You did not create a downloads/ directory, or 2. The external storage is not at /sdcard and you used that string literally rather than Environment.getExternalFileStorage(), or 3. The user does not have an SD card installed, or... There are probably other possible causes, but those three come to mind. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Hi Mark, Thanks for immediate reply. I checked these conditions, when we tried to push a file using adb is working fine, but only through the below code, we are seeing the exception: public void addFile(String filename) throws Exception{ InputStream is = this.getInstrumentation().getContext ().getAssets().open(filename); File directory = new File (Environment.getExternalStorageDirectory().getPath()+/downloads); if (!directory.exists()) { directory.mkdir(); } File file = new File(directory.getPath()+/+filename); if (!file.exists() directory.exists()){ try { file.createNewFile(); } catch (IOException e) { Log.d(TAG,File creation failed for + file); } } if (file.exists() file.canWrite()){ FileOutputStream os = new FileOutputStream(file); byte[] b = new byte[1024]; int len; while ((len = is.read(b))0){ os.write(b,0,len); } os.flush(); os.close(); is.close(); } else { Log.e(TAG, Failed to write the file to SDCard); } } Thanks, Android user. On Oct 15, 10:36 am, Mark Murphy mmur...@commonsware.com wrote: androiduser mobile wrote: Hi all, I am facing a weird problem now, I have a piece of code which copies the files from assets folder to sdcard/downloads and is working well for me, but when other user is running this code in his system, he is getting Parent directory does not exist exception with file.createNewFile(). We both are using the same android SDK. Can anyone suggest what makes it work differently in different systems? Perhaps the other user does not have an /sdcard/downloads/ directory, either because: 1. You did not create a downloads/ directory, or 2. The external storage is not at /sdcard and you used that string literally rather than Environment.getExternalFileStorage(), or 3. The user does not have an SD card installed, or... There are probably other possible causes, but those three come to mind. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
androiduser mobile wrote: File directory = new File (Environment.getExternalStorageDirectory().getPath()+/downloads); Creating paths via concatenation is bad form and prone to error (e.g., duplicate slashes). Use: new File(Environment.getExternalStorageDirectory(), downloads); File file = new File(directory.getPath()+/+filename); See above. if (!file.exists() directory.exists()){ try { file.createNewFile(); } catch (IOException e) { Log.d(TAG,File creation failed for + file); } } Is the SD card on the target device formatted FAT32, or something else? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Hi Mark, we did try these but no luck. We tried with same SD card what I am using. No formatting issue. Thanks, Android user On Oct 15, 10:49 am, Mark Murphy mmur...@commonsware.com wrote: androiduser mobile wrote: File directory = new File (Environment.getExternalStorageDirectory().getPath()+/downloads); Creating paths via concatenation is bad form and prone to error (e.g., duplicate slashes). Use: new File(Environment.getExternalStorageDirectory(), downloads); File file = new File(directory.getPath()+/+filename); See above. if (!file.exists() directory.exists()){ try { file.createNewFile(); } catch (IOException e) { Log.d(TAG,File creation failed for + file); } } Is the SD card on the target device formatted FAT32, or something else? -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
I think you only need to add the permission as suggested by androiduser mobile to be able to write to the SD Card. uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
WRITE_EXTERNAL_STORAGE is there in 1.6 what abt 1.5 ??? On Sep 10, 12:30 am, androiduser mobile androiduser.mob...@gmail.com wrote: I got it working with a permission change in the manifest file. I added WRITE_EXTERNAL_STORAGE and it worked like a gem :)). On Sep 9, 12:13 pm, Chris Stratton cs07...@gmail.com wrote: On Jul 17, 6:24 pm, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch thesdcardvia adb shell gives me a permission denied message... FYI there's no touch command in the shell or /system/bin and the shell apparently considers permission denied to be a good substitute for [command] not found but you can cat /sdcard/testfile and then ^D --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Applications targeted for 1.0, 1.1 and 1.5 will be able to write to the external storage without any permissions. They will continue to work just like they have till today. http://developer.android.com/sdk/android-1.6.html#api-changes WRITE_EXTERNAL_STORAGE: Allows an application to write to external storage. Applications using API Level 3 and lower will be implicitly granted this permission (and this will be visible to the user); Applications using API Level 4 or higher must explicitly request this permission. Tauno On Thu, Sep 17, 2009 at 10:25 AM, Shrenik Vikam shre...@ruby-solutions.com wrote: WRITE_EXTERNAL_STORAGE is there in 1.6 what abt 1.5 ??? On Sep 10, 12:30 am, androiduser mobile androiduser.mob...@gmail.com wrote: I got it working with a permission change in the manifest file. I added WRITE_EXTERNAL_STORAGE and it worked like a gem :)). On Sep 9, 12:13 pm, Chris Stratton cs07...@gmail.com wrote: On Jul 17, 6:24 pm, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch thesdcardvia adb shell gives me a permission denied message... FYI there's no touch command in the shell or /system/bin and the shell apparently considers permission denied to be a good substitute for [command] not found but you can cat /sdcard/testfile and then ^D --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Hi doubleminus, Did you resolve this issue? Can you please provide me the solution. I am stuck with this issue. Thanks, Android user On Aug 17, 7:15 am, Dany BREARD dany.bre...@gmail.com wrote: Hi I have the same issue but I can't change my /sdcard permission. I have windows xp, I try to change /sdcard permission as this url: http://www.vulgarisation-informatique.com/droits-acces.php but permission don't change. please help me how can I change this permisson in windows xp ? It's look like: +datapermissions : drwxrwx--x +sdcardpermissions : d- +system permissions : drwxr-xr- On Jul 18, 4:40 am, ekwang ekwa...@gmail.com wrote: You can use ddms tool for verify whether sdcard was inserted or not. #android-sdk-windows-1.5_r2\tools\ddms select Device -FileExplore below is correct permissions value. +data permissions : drwxrwx--x +sdcardpermissions : drwxrwxrwx +system permissions : drwxr-xr-x If sdcard permissions was look d- It means sdcard is not inserted. On Jul 18, 7:24 am, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch the sdcard via adb shell gives me a permissiondenied message... On Jul 16, 10:49 pm, doubleminus doublemi...@gmail.com wrote: Right now, file_name is just set to 12880+-+po_number.getText ().toString(); When I put /sdcard/ (or sdcard/ into myfilepath I get IOException: Parent directory offiledoes not exist: /sdcard/sdcard/ 12880-231 If I get rid of the sdcard/ prefix, I get this exception: FileNotFoundException: /data/data/com.heroku.blacksky/files/12880-222 Here's the newfilecreation code, based on everyone's suggestions: file1 = newFile(Environment.getExternalStorageDirectory(), file_name); file1.createNewFile(); file_out = new FileOutputStream(file1); buf = new BufferedOutputStream(file_out); out_stream = new OutputStreamWriter(buf); Please let me know your thoughts. I'm still quite confused by this. double On Jul 16, 12:12 am, Kaj Bjurman kaj.bjur...@gmail.com wrote: I can't see that you are using file1 after that line. You are using file_name. On 14 Juli, 18:09, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? Filefile1 = newFile(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that thefiledoes not exist... that means you should create it. UseFile#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re:Unabletowritetextfileto sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need towritea fairly simple .csvfileto the device's sdcard (so it can then be emailed via Intent). The below code does notwritethe file. Filefile1 = newFile(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); //writefields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from thefileon the device (printing above output, using fileinputstream, to an edittext. How can I get to thisfileon the sdcard? Thanks! double -- Romain Guy Android framework
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
On Jul 17, 6:24 pm, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch the sdcard via adb shell gives me a permission denied message... FYI there's no touch command in the shell or /system/bin and the shell apparently considers permission denied to be a good substitute for [command] not found but you can cat /sdcard/testfile and then ^D --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
I got it working with a permission change in the manifest file. I added WRITE_EXTERNAL_STORAGE and it worked like a gem :)). On Sep 9, 12:13 pm, Chris Stratton cs07...@gmail.com wrote: On Jul 17, 6:24 pm, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch the sdcard via adb shell gives me a permission denied message... FYI there's no touch command in the shell or /system/bin and the shell apparently considers permission denied to be a good substitute for [command] not found but you can cat /sdcard/testfile and then ^D --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Hi I have the same issue but I can't change my /sdcard permission. I have windows xp, I try to change /sdcard permission as this url: http://www.vulgarisation-informatique.com/droits-acces.php but permission don't change. please help me how can I change this permisson in windows xp ? It's look like: +datapermissions : drwxrwx--x +sdcardpermissions : d- +system permissions : drwxr-xr- On Jul 18, 4:40 am, ekwang ekwa...@gmail.com wrote: You can use ddms tool for verify whether sdcard was inserted or not. #android-sdk-windows-1.5_r2\tools\ddms select Device - File Explore below is correct permissions value. +data permissions : drwxrwx--x +sdcardpermissions : drwxrwxrwx +system permissions : drwxr-xr-x If sdcard permissions was look d- It means sdcard is not inserted. On Jul 18, 7:24 am, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch the sdcard via adb shell gives me a permissiondenied message... On Jul 16, 10:49 pm, doubleminus doublemi...@gmail.com wrote: Right now, file_name is just set to 12880+-+po_number.getText ().toString(); When I put /sdcard/ (or sdcard/ into my file path I get IOException: Parent directory of file does not exist: /sdcard/sdcard/ 12880-231 If I get rid of the sdcard/ prefix, I get this exception: FileNotFoundException: /data/data/com.heroku.blacksky/files/12880-222 Here's the new file creation code, based on everyone's suggestions: file1 = new File(Environment.getExternalStorageDirectory(), file_name); file1.createNewFile(); file_out = new FileOutputStream(file1); buf = new BufferedOutputStream(file_out); out_stream = new OutputStreamWriter(buf); Please let me know your thoughts. I'm still quite confused by this. double On Jul 16, 12:12 am, Kaj Bjurman kaj.bjur...@gmail.com wrote: I can't see that you are using file1 after that line. You are using file_name. On 14 Juli, 18:09, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
How does it fail? I wrote some code that creates a directory on the sdcard, and writes files to that directory. I can't remember that I had any problems at all. .. I'm however root on the phone, but I hope that that doesn't matter. File directory = new File(/sdcard/mydir); if (!directory.exists()) { directory.mkdirs(); } FileOutputStream out = new FileOutputStream(directory.getPath() + / filename.txt); //Write to out On 5 Aug, 00:19, doubleminus doublemi...@gmail.com wrote: Any help here? I'm still flummoxed and unable to write to the sd card. Thanks! double On Jul 29, 1:39 pm, doubleminus doublemi...@gmail.com wrote: So...it seems that something is messed up with my permissions, as noted above. Is this the case? What is the remedy here? I've tried twiddling with some settings on the phone to get access to thesdcard...but no luck. Please let me know. Thanks, double On Jul 26, 1:17 am, doubleminus doublemi...@gmail.com wrote: This is for a physical device. ddms shows: +sdcard permissions: d---rwxrwx I still cannot write to thiscard. thanks, double On Jul 17, 7:40 pm, ekwang ekwa...@gmail.com wrote: You can use ddms tool for verify whether sdcard was inserted or not. #android-sdk-windows-1.5_r2\tools\ddms select Device - File Explore below is correct permissions value. +datapermissions : drwxrwx--x +sdcardpermissions : drwxrwxrwx +system permissions : drwxr-xr-x If sdcard permissions was look d- It means sdcard is not inserted. On Jul 18, 7:24 am, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch the sdcard via adb shell gives me a permission denied message... On Jul 16, 10:49 pm, doubleminus doublemi...@gmail.com wrote: Right now, file_name is just set to 12880+-+po_number.getText ().toString(); When I put /sdcard/ (or sdcard/ into my file path I get IOException: Parent directory of file does not exist: /sdcard/sdcard/ 12880-231 If I get rid of the sdcard/ prefix, I get this exception: FileNotFoundException: /data/data/com.heroku.blacksky/files/12880-222 Here's the new file creation code, based on everyone's suggestions: file1 = new File(Environment.getExternalStorageDirectory(), file_name); file1.createNewFile(); file_out = new FileOutputStream(file1); buf = new BufferedOutputStream(file_out); out_stream = new OutputStreamWriter(buf); Please let me know your thoughts. I'm still quite confused by this. double On Jul 16, 12:12 am, Kaj Bjurman kaj.bjur...@gmail.com wrote: I can't see that you are using file1 after that line. You are using file_name. On 14 Juli, 18:09, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Any help here? I'm still flummoxed and unable to write to the sd card. Thanks! double On Jul 29, 1:39 pm, doubleminus doublemi...@gmail.com wrote: So...it seems that something is messed up with my permissions, as noted above. Is this the case? What is the remedy here? I've tried twiddling with some settings on the phone to get access to thesdcard...but no luck. Please let me know. Thanks, double On Jul 26, 1:17 am, doubleminus doublemi...@gmail.com wrote: This is for a physical device. ddms shows: +sdcard permissions: d---rwxrwx I still cannot write to thiscard. thanks, double On Jul 17, 7:40 pm, ekwang ekwa...@gmail.com wrote: You can use ddms tool for verify whether sdcard was inserted or not. #android-sdk-windows-1.5_r2\tools\ddms select Device - File Explore below is correct permissions value. +datapermissions : drwxrwx--x +sdcardpermissions : drwxrwxrwx +system permissions : drwxr-xr-x If sdcard permissions was look d- It means sdcard is not inserted. On Jul 18, 7:24 am, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch the sdcard via adb shell gives me a permission denied message... On Jul 16, 10:49 pm, doubleminus doublemi...@gmail.com wrote: Right now, file_name is just set to 12880+-+po_number.getText ().toString(); When I put /sdcard/ (or sdcard/ into my file path I get IOException: Parent directory of file does not exist: /sdcard/sdcard/ 12880-231 If I get rid of the sdcard/ prefix, I get this exception: FileNotFoundException: /data/data/com.heroku.blacksky/files/12880-222 Here's the new file creation code, based on everyone's suggestions: file1 = new File(Environment.getExternalStorageDirectory(), file_name); file1.createNewFile(); file_out = new FileOutputStream(file1); buf = new BufferedOutputStream(file_out); out_stream = new OutputStreamWriter(buf); Please let me know your thoughts. I'm still quite confused by this. double On Jul 16, 12:12 am, Kaj Bjurman kaj.bjur...@gmail.com wrote: I can't see that you are using file1 after that line. You are using file_name. On 14 Juli, 18:09, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext.
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
So...it seems that something is messed up with my permissions, as noted above. Is this the case? What is the remedy here? I've tried twiddling with some settings on the phone to get access to the sd card...but no luck. Please let me know. Thanks, double On Jul 26, 1:17 am, doubleminus doublemi...@gmail.com wrote: This is for a physical device. ddms shows: +sdcard permissions: d---rwxrwx I still cannot write to thiscard. thanks, double On Jul 17, 7:40 pm, ekwang ekwa...@gmail.com wrote: You can use ddms tool for verify whether sdcard was inserted or not. #android-sdk-windows-1.5_r2\tools\ddms select Device - File Explore below is correct permissions value. +datapermissions : drwxrwx--x +sdcardpermissions : drwxrwxrwx +system permissions : drwxr-xr-x If sdcard permissions was look d- It means sdcard is not inserted. On Jul 18, 7:24 am, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch the sdcard via adb shell gives me a permission denied message... On Jul 16, 10:49 pm, doubleminus doublemi...@gmail.com wrote: Right now, file_name is just set to 12880+-+po_number.getText ().toString(); When I put /sdcard/ (or sdcard/ into my file path I get IOException: Parent directory of file does not exist: /sdcard/sdcard/ 12880-231 If I get rid of the sdcard/ prefix, I get this exception: FileNotFoundException: /data/data/com.heroku.blacksky/files/12880-222 Here's the new file creation code, based on everyone's suggestions: file1 = new File(Environment.getExternalStorageDirectory(), file_name); file1.createNewFile(); file_out = new FileOutputStream(file1); buf = new BufferedOutputStream(file_out); out_stream = new OutputStreamWriter(buf); Please let me know your thoughts. I'm still quite confused by this. double On Jul 16, 12:12 am, Kaj Bjurman kaj.bjur...@gmail.com wrote: I can't see that you are using file1 after that line. You are using file_name. On 14 Juli, 18:09, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
This is for a physical device. ddms shows: +sdcard permissions: d---rwxrwx I still cannot write to this card. thanks, double On Jul 17, 7:40 pm, ekwang ekwa...@gmail.com wrote: You can use ddms tool for verify whether sdcard was inserted or not. #android-sdk-windows-1.5_r2\tools\ddms select Device - File Explore below is correct permissions value. +datapermissions : drwxrwx--x +sdcardpermissions : drwxrwxrwx +system permissions : drwxr-xr-x If sdcard permissions was look d- It means sdcard is not inserted. On Jul 18, 7:24 am, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch the sdcard via adb shell gives me a permission denied message... On Jul 16, 10:49 pm, doubleminus doublemi...@gmail.com wrote: Right now, file_name is just set to 12880+-+po_number.getText ().toString(); When I put /sdcard/ (or sdcard/ into my file path I get IOException: Parent directory of file does not exist: /sdcard/sdcard/ 12880-231 If I get rid of the sdcard/ prefix, I get this exception: FileNotFoundException: /data/data/com.heroku.blacksky/files/12880-222 Here's the new file creation code, based on everyone's suggestions: file1 = new File(Environment.getExternalStorageDirectory(), file_name); file1.createNewFile(); file_out = new FileOutputStream(file1); buf = new BufferedOutputStream(file_out); out_stream = new OutputStreamWriter(buf); Please let me know your thoughts. I'm still quite confused by this. double On Jul 16, 12:12 am, Kaj Bjurman kaj.bjur...@gmail.com wrote: I can't see that you are using file1 after that line. You are using file_name. On 14 Juli, 18:09, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代!http://im.live.cn/emoticons/-Hidequotedtext- - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
You can use ddms tool for verify whether sdcard was inserted or not. #android-sdk-windows-1.5_r2\tools\ddms select Device - File Explore below is correct permissions value. +datapermissions : drwxrwx--x +sdcardpermissions : drwxrwxrwx +system permissions : drwxr-xr-x If sdcard permissions was look d- It means sdcard is not inserted. On Jul 18, 7:24 am, doubleminus doublemi...@gmail.com wrote: Is it a permissions issue? Trying to touch the sdcard via adb shell gives me a permission denied message... On Jul 16, 10:49 pm, doubleminus doublemi...@gmail.com wrote: Right now, file_name is just set to 12880+-+po_number.getText ().toString(); When I put /sdcard/ (or sdcard/ into my file path I get IOException: Parent directory of file does not exist: /sdcard/sdcard/ 12880-231 If I get rid of the sdcard/ prefix, I get this exception: FileNotFoundException: /data/data/com.heroku.blacksky/files/12880-222 Here's the new file creation code, based on everyone's suggestions: file1 = new File(Environment.getExternalStorageDirectory(), file_name); file1.createNewFile(); file_out = new FileOutputStream(file1); buf = new BufferedOutputStream(file_out); out_stream = new OutputStreamWriter(buf); Please let me know your thoughts. I'm still quite confused by this. double On Jul 16, 12:12 am, Kaj Bjurman kaj.bjur...@gmail.com wrote: I can't see that you are using file1 after that line. You are using file_name. On 14 Juli, 18:09, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代!http://im.live.cn/emoticons/-Hidequotedtext- - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
What is file_name set to? Does it also include a path to the sdcard? On 13 Juli, 23:53, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代!http://im.live.cn/emoticons/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
I can't see that you are using file1 after that line. You are using file_name. On 14 Juli, 18:09, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代!http://im.live.cn/emoticons/-Hidequoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Right now, file_name is just set to 12880+-+po_number.getText ().toString(); When I put /sdcard/ (or sdcard/ into my file path I get IOException: Parent directory of file does not exist: /sdcard/sdcard/ 12880-231 If I get rid of the sdcard/ prefix, I get this exception: FileNotFoundException: /data/data/com.heroku.blacksky/files/12880-222 Here's the new file creation code, based on everyone's suggestions: file1 = new File(Environment.getExternalStorageDirectory(), file_name); file1.createNewFile(); file_out = new FileOutputStream(file1); buf = new BufferedOutputStream(file_out); out_stream = new OutputStreamWriter(buf); Please let me know your thoughts. I'm still quite confused by this. double On Jul 16, 12:12 am, Kaj Bjurman kaj.bjur...@gmail.com wrote: I can't see that you are using file1 after that line. You are using file_name. On 14 Juli, 18:09, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代!http://im.live.cn/emoticons/-Hidequotedtext - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Anyone?? On Jul 14, 9:09 am, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代!http://im.live.cn/emoticons/-Hidequoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
doubleminus wrote: Anyone?? On Jul 14, 9:09 am, doubleminus doublemi...@gmail.com wrote: Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); No. That statement create a Java object, in memory, and does not affect the file system at all. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Isn't that what the first lines of code do? File file1 = new File(Environment.getExternalStorageDirectory(), file_name); On Jul 13, 3:02 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代!http://im.live.cn/emoticons/-Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Hmm, this change causes the code to throw an exception (filenotfound). Is there something else I should do/change in addition to this? On Jul 12, 9:29 pm, Romain Guy romain...@google.com wrote: Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代! http://im.live.cn/emoticons/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代!http://im.live.cn/emoticons/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Simple. :-) The error says that the file does not exist... that means you should create it. Use File#createNewFile(). On Jul 13, 5:53 pm, doubleminus doublemi...@gmail.com wrote: Romain is? I don't understand. Is there something I should be doing to avoid filenotfound exception? On Jul 13, 12:40 am, 郑伟 loveheaven_zheng...@hotmail.com wrote: You are right... Date: Sun, 12 Jul 2009 21:29:28 -0700 Subject: [android-developers] Re: Unable to write text file to sdcard on physical G1 device From: romain...@google.com To: android-developers@googlegroups.com Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 _ MSN 表情魔法书,改变你的对话时代!http://im.live.cn/emoticons/- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Unable to write text file to sdcard on physical G1 device
Hi, Instead of: FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); Just use: FileOutputStream file_out = new FileOutputStream(file_name); This should work. On Sun, Jul 12, 2009 at 8:10 PM, doubleminusdoublemi...@gmail.com wrote: I need to write a fairly simple .csv file to the device's sdcard (so it can then be emailed via Intent). The below code does not write the file. File file1 = new File(Environment.getExternalStorageDirectory(), file_name); FileOutputStream file_out = openFileOutput (file_name,MODE_WORLD_READABLE); BufferedOutputStream buf = new BufferedOutputStream(file_out); OutputStreamWriter out_stream = new OutputStreamWriter(buf); // write fields in first row of spreadsheet then a new line for (int i = 0; i FIELDS.length; i++) { if (i != FIELDS.length - 1) out_stream.write(FIELDS[i] + ,); else out_stream.write(FIELDS[i]); } out_stream.write(\n); // more code here I flush and close out_stream. I can even seem to be able to read from the file on the device (printing above output, using fileinputstream, to an edittext. How can I get to this file on the sdcard? Thanks! double -- Romain Guy Android framework engineer romain...@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 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---