How to write to an external text file in Android?

后端 未结 3 1992
轻奢々
轻奢々 2021-01-17 05:02

I want to write a string line in a text file in android project (using Eclipse). This is the code which i am trying but its not working...

    String s=\"hel         


        
3条回答
  •  萌比男神i
    2021-01-17 05:44

    There are two ways to understand your question:

    1. You want to write the file to c: drive in your computer - well you can't. If you want to save some file from android to your computer programmatic, you'll have to send it via network.
    2. You want to write to some place in the android FS - in this case c:\ is irreleveant, since this is a windows path, and android is unix based, meaning all paths start from root (/) also, android SDK provides you a few methods to access relevant directories files without using a fixed path. see here: http://developer.android.com/guide/topics/data/data-storage.html

提交回复
热议问题