I want to write a string string in a text file in an android project (using Eclipse). This is the code I'm trying but not working ...
String s="hello azeem\n"; try{ FileOutputStream fos = openFileOutput("C:\\eventslog.txt", Context.MODE_PRIVATE); fos.write(s.getBytes()); fos.close(); } catch (Exception e){ }
Any ideas?
There are two ways to understand your question:
c:\
/
Android SD- . Android Bridge (adb.exe, sdk\platform-tools), txt ... - Windows.
( foo.txt android)
bar.bat:
adb pull /sdcard/Android/data/com.example.yourapp/files/foo.txt C:\foo.txt
bar.bat. . foo.txt sdcard C:\foo.txt
, . Windows.
You may not have added his permission ...
here:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>