java - read/write internal storage android -


i have question regarding internal files in android.. tried write data file , read however, seems can't write data file unless cast integer first.. there anyway can save double or float values.. added code i'm trying use below:

formatcluster formatcluster = ((formatcluster)objectcluster.returnformatcluster(offormats,"calibrated"));  if (formatcluster != null) { //obtain data text view calibrateddataarray[0] = formatcluster.mdata; calibratedunits = formatcluster.munits; a.settext("data: " + formatcluster.mdata);  string filename = "myfile"; //string string = "hello world!"; fileoutputstream outputstream;  try {   outputstream = openfileoutput(filename, context.mode_private);   outputstream.write((int)formatcluster.mdata);//here don't want cast value integer   outputstream.close(); } catch (exception e) {   e.printstacktrace(); }  //testing.settext)  double ch; stringbuffer filecontent = new stringbuffer(""); fileinputstream fis; try { fis = context.openfileinput( filename ); try { while( (ch = fis.read()) != -1) testing.settext(filecontent.append(ch)); } catch (ioexception e) { e.printstacktrace(); } } catch (filenotfoundexception e) { e.printstacktrace(); } 

envelope inputstream , outputstream datainputstream , dataoutputstream. these classes have method need


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -