How to write to an external text file in Android?

后端 未结 3 1961
轻奢々
轻奢々 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条回答
  •  攒了一身酷
    2021-01-17 05:36

    Write the text in Android to the device's sdcard. Use Android Bridge (adb.exe found in sdk\platform-tools) to pull the txt file onto your drive... in your case, a windows disk.

    (write text to foo.txt in android)

    in a command bar.bat:

    adb pull /sdcard/Android/data/com.example.yourapp/files/foo.txt C:\foo.txt
    

    Run the bar.bat file. That's it. foo.txt now exists on the sdcard and on C:\foo.txt

    Sorry if this does not match your intent. You must invoke the batch file from Windows.

提交回复
热议问题