[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
[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
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
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: Sending Email from Android application
Swathi, Did you ever figure this one out?? Thanks, double On May 12, 1:40 am, Swathi swathimuddin...@gmail.com wrote: I have tried to sendemailfrom myapplication in emulator , with following code. Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto); sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject.getText().toString()); sendIntent.putExtra(Intent.EXTRA_TEXT, body.getText().toString()); sendIntent.setType(text/plain); startActivity(Intent.createChooser(sendIntent, MySendMail)); But i got an error No applications can perform this action. I tried by configuring Gmail in emulator, with the following code boolean debug = false; //Set the host smtp address Properties props = new Properties(); props.setProperty(mail.transport.protocol, smtp); props.setProperty(mail.host, smtp.gmail.com); props.put(mail.smtp.auth, true); props.put(mail.smtp.port, 465); props.put(mail.smtp.socketFactory.port, 465); props.put(mail.smtp.socketFactory.class, javax.net.ssl.SSLSocketFactory); props.put(mail.smtp.socketFactory.fallback, false); props.setProperty(mail.smtp.quitwait, false); Session session = Session.getDefaultInstance(props, this); session.setDebug(debug); try { // create a message Message msg = new MimeMessage(session); // set the from and to address InternetAddress addressFrom = new InternetAddress(from); msg.setFrom(addressFrom); InternetAddress[] addressTo = new InternetAddress[recipients.length]; for (int i = 0; i recipients.length; i++) { addressTo[i] = new InternetAddress(recipients[i]); } msg.setRecipients(Message.RecipientType.TO, addressTo); // Setting the Subject and Content Type msg.setSubject(subject); msg.setContent(message, text/html); Transport.send(msg); } catch (Exception e) { // TODO: handle exception System.out.println(Exception in Message+e.getMessage()); } } But i got an error but i got an error java.lang.verifyError:javax.mail.internet.Mimemessage. Can anybody help me? --~--~-~--~~~---~--~~ 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: Two page form question - saving data from first page
Ah. So I'll likely be using a listener of some sort or a app Preference object - and not writing to the database? Good to know. I hadn't thought of the obvious issues you've brought up (user moving away from application then coming back). The data does not need to be preserved beyond the generation of the text file...but definitely does need to persist until that file is created. On Jun 15, 7:14 am, gjs garyjamessi...@gmail.com wrote: Hi there, You may need to save your data from the spinners earlier using the various Listeners in order to cater for other events - eg press Home/ Back button, keyboard open/cose, phone rings etc - other than just when user 'clicks button to move to next page'. You can also save the data from spinners etc into application Preference objects, these can also be used to persist (read write) data across app invocations. Regards On Jun 14, 4:03 pm, doubleminus doublemi...@gmail.com wrote: This is a general architectural question. I want to offer a user a simple two page form. The first page will have a few Spinners for the user to select options from. The second page will have a series of EditTexts for the user to fill in. After the second page, the user clicks a button to generate a text file based on the values they have input. My question is: What is the best way to handle preserving the data from the spinners on the first page of the form, in order to place them into the text file? I feel like the architecture should be something like this: 1. User selects Spinner values on first page and clicks button to move to next page of form.. 2. Spinner values are placed in database 3. User fills in EditTexts on second page. Clicks button to generate text file. 4. Database is queried for Spinner values, which are added to newly created text file, then EditText values are added Does this strategy make sense? Does anyone have advice on a better way of handling the gathering of two pages of form input then using it to create a text file? The user would need to be able to flip back and forth between the form pages as needed. --~--~-~--~~~---~--~~ 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] Two page form question - saving data from first page
This is a general architectural question. I want to offer a user a simple two page form. The first page will have a few Spinners for the user to select options from. The second page will have a series of EditTexts for the user to fill in. After the second page, the user clicks a button to generate a text file based on the values they have input. My question is: What is the best way to handle preserving the data from the spinners on the first page of the form, in order to place them into the text file? I feel like the architecture should be something like this: 1. User selects Spinner values on first page and clicks button to move to next page of form.. 2. Spinner values are placed in database 3. User fills in EditTexts on second page. Clicks button to generate text file. 4. Database is queried for Spinner values, which are added to newly created text file, then EditText values are added Does this strategy make sense? Does anyone have advice on a better way of handling the gathering of two pages of form input then using it to create a text file? The user would need to be able to flip back and forth between the form pages as needed. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---