How to write a file in Android/Java? -


i try write text file cannot view file, , not write.

the bit of code focusing on @ moment is:

string file_name = ".txt"; string title = ed1.gettext().tostring(); try {       fileoutputstream fileout=openfileoutput("mytextfile.txt", mode_private);       outputstreamwriter outputwriter=new outputstreamwriter(fileout);       outputwriter.write("job title");       outputwriter.write(ed1.gettext().tostring());       outputwriter.close();       toast.maketext(getbasecontext(), "file saved successfully!",       toast.length_short).show();     } catch (exception e) {       e.printstacktrace();     } 

here errors coming out of logcat:

07-25 12:22:39.775 4537-4537/? e/phoneinterfacemanager: [phoneintfmgr] geticcid: icc id null or empty. 07-25 12:22:40.628 1556-4236/? e/motosensors: proximity covered 1 07-25 12:22:41.067 1556-4236/? e/motosensors: proximity covered 2 07-25 12:22:41.563 1556-4275/? e/wifiscanningservice: got invalid work source request: worksource{} clientinfo[uid=10028] 07-25 12:22:41.585 1556-4275/? e/wifiscanningservice: got invalid work source request: worksource{} clientinfo[uid=10028] 07-25 12:22:41.790 639-639/? e/cnss-daemon: stale or unreachable neighbors, ndm state: 16 07-25 12:22:42.774 1556-4467/? e/locsvc_eng: e/calling gnss_sv_status_cb 07-25 12:22:43.687 1556-4467/? e/locsvc_eng: e/calling gnss_sv_status_cb 07-25 12:22:43.775 1556-4467/? e/locsvc_eng: e/calling gnss_sv_status_cb 07-25 12:22:44.782 1556-4467/? e/locsvc_eng: e/calling gnss_sv_status_cb 07-25 12:22:44.802 1556-4467/? e/activitymanager: sending non-protected broadcast com.motorola.location.instrumentation system 1556:system/1000 pkg android                                                   java.lang.throwable                                                       @ com.android.server.am.activitymanagerservice.broadcastintentlocked(activitymanagerservice.java:18226)                                                       @ com.android.server.am.activitymanagerservice.broadcastintent(activitymanagerservice.java:18826)                                                       @ android.app.contextimpl.sendbroadcast(contextimpl.java:926)                                                       @ com.android.server.location.gnsslocationprovider.reportstatus(gnsslocationprovider.java:1977) 07-25 12:22:58.150 639-639/? e/cnss-daemon: stale or unreachable neighbors, ndm state: 4 07-25 12:22:58.937 639-639/? e/cnss-daemon: stale or unreachable neighbors, ndm state: 4 07-25 12:23:00.610 1556-4236/? e/motosensors: proximity uncovered 07-25 12:23:02.712 1556-5513/? e/locsvc_libulp: e/int ulp_brain_transition_all_providers(), no quipc/gnss transition logic run due both engines off  07-25 12:23:03.126 1556-4236/? e/motosensors: proximity covered 1 07-25 12:23:03.445 1556-4236/? e/motosensors: proximity uncovered 07-25 12:23:04.093 639-639/? e/cnss-daemon: gateway mac address: 00:00:00:00:00:00 07-25 12:23:04.093 639-639/? e/cnss-daemon: invalid mac address: 0xb0656e6cm 

please tell me doing wrong! tried view files on computer phone app is. but, no files saving phone's internal storage.

 string file_name = ".txt";   string title = ed1.gettext().tostring();  try {         fileoutputstream fos = openfileoutput(file_name, context.mode_private);         objectoutputstream of = new objectoutputstream(fos);         of.writeobject(title);         of.flush();         of.close();         fos.close();     } catch (exception e) {         throw new runtimeexception(e);     } 

try this


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -