wood burning stoves 2.0*
The moose likes Android and the fly likes Unable to read file from Emulator's SD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Unable to read file from Emulator Watch "Unable to read file from Emulator New topic
Author

Unable to read file from Emulator's SD

Vishal Trivedi
Ranch Hand

Joined: Sep 05, 2011
Posts: 57
Hello

I havebeen trying to create and Read a file from SDCard however I am unable to read file.The wrting of file and reading is done in the same activity.And I have also made changes in AndroidManifest.

Please help me find my error and I know it has to be silly.
Here is my code




Every thing here seems ok except i m getting null value when i readLine()

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Do you have this permission in your manifest:



JBoss In Action
Vishal Trivedi
Ranch Hand

Joined: Sep 05, 2011
Posts: 57
Yes ...

I even tried using open[In/Out]putFile()....

Still not working....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41104
    
  45
Vishal Trivedi wrote:not working

Which means what, exactly? Logcat output, please.


Ping & DNS - my free Android networking tools app
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Looking at your code, it looks like you forgot to close the file after writing it. The readline() won't find any content until the buffer is flushed, and closing the file will do that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to read file from Emulator's SD
 
Similar Threads
Interactive Stories on Android
Connect to server on LAN
Sending a pdf file to client from server through web service
Unable to read more than one text files stored in sdcard
Send variable value from one activity to another