-1

~NO NEED HELP ANYMORE, THANKS~

I have been looking for this answer on this site, but none of the code worked.

Here is my function:

public void onClickTemp(View view)
{

}

Using this function, I want to write code that creates a *.txt file in an sdcard with some text in it. I would be happy for examples how to read and change this *.txt file as well, but let's start with creating one.

I do have permission to write to external storage, and I checked the file explorer with DDMS.

Edit: I succeed creating txt file (:

The problem was: My emulator didn't have SD card.

Solution:android emulator - any accessible storage space?

Edit2: Figured out about reading files (:

Solution:How can I read a text file in Android?

Edit3:

Understood editing aswell( found some guide in google, i don't have link sorry)

At this moment, i don't have anymore questions, thanks for help!

Community
  • 1
  • 1
hey
  • 3
  • 9
  • It still doesn't work Here the errors on DDMS: 01-31 09:45:53.119: W/System.err(6258): java.io.FileNotFoundException: /storage/sdcard/Notes/banana.txt: open failed: EACCES (Permission denied) Althought i did write permission in manifest file.. – hey Jan 31 '14 at 14:48
  • Are you testing with a device or emulator? – GhostDerfel Jan 31 '14 at 14:50
  • Where's your code? What have you tried? – Phil Jan 31 '14 at 14:56
  • I'm testing with the emulator, and i tried with code that GhostDerfel gave( on link), but thats not the first code, i have tried many others aswell. – hey Jan 31 '14 at 15:28
  • have you tried using the app dir path? (context.getFilesDir()) – GhostDerfel Jan 31 '14 at 15:45
  • No.. i have no idea what is that. Can you give full example of what to write inside my onclick function? – hey Jan 31 '14 at 16:57
  • Your emulator may not have any external storage mounted. Aside from that, to the degree to which this is even a question, it is a duplicate as already pointed out. – Chris Stratton Jan 31 '14 at 17:49
  • In DDMS file explorer i can see the folders and files, however the SD card is empty, maybe you right that it's not mounted, than how to mount it? – hey Jan 31 '14 at 18:01
  • OMG THAT WORKS, yes my SD card wasnt mounted! http://stackoverflow.com/questions/7493225/android-emulator-any-accessible-storage-space however, Chris Stratton i have to give you reputation for your help, how to do that? By the way, now how to read/change files?! (: – hey Jan 31 '14 at 18:11

1 Answers1

0

Edit: I succeed creating txt file (:

The problem was: My emulator didn't have SD card.

Solution:android emulator - any accessible storage space?

Edit2: Figured out about reading files (:

Solution:How can I read a text file in Android?

Edit3:

Understood editing aswell( found some guide in google, i don't have link sorry)

Community
  • 1
  • 1
hey
  • 3
  • 9