in which path should i need to put the text file to write in android -
i have android app , need write string values in text file. have coding write in text file. don't know should create text file.please refer code below,
fileoutputstream fout = null; outputstreamwriter osw = null; try{ fout = openfileoutput(“public.dat”, context.mode_private); osw = new outputstreamwriter(fout); osw.write(“text”); osw.close(); fout.close(); }catch(exception e){ e.printstacktrace(system.err); }
please inform me in path should create text file.
if want store data locally app, on device's internal file system (not on external sd card), should consider sharedpreferences, are, default, private files in private storage space of app, convenient access.
sharedpreferences perfect key/value pairs, not suitable data formats. if have different needs, context
class has broad variety of methods on offer. please note both activity
, application
objects context
s you'll able access these. please refer documentation:
there methods path external sd cards mounted on particular device, temporary files, etc.
Comments
Post a Comment