Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to read file from Emulator's SD

 
Vishal Trivedi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have this permission in your manifest:

 
Vishal Trivedi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes ...

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

Still not working....
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vishal Trivedi wrote:not working

Which means what, exactly? Logcat output, please.
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic