android - Save more than one string using OutputStreamWriter -


in app user taps screen gain score. , score can buy upgrades. want able save 3 integer values :counter,add,singleclick. know how save first integer value counter, when copy , paste same method , replace counter integer add integer doesn't work. can guys show me how save other integer values.

please , thank you

public void writecounttofile() {     try {         outputstreamwriter outputstreamwriter = new outputstreamwriter(openfileoutput("countvalue.txt", context.mode_private));         outputstreamwriter.write(string.valueof(counter));         outputstreamwriter.close();     } catch (ioexception e) {         log.v("myactivity", e.tostring());     } }   private  int readcountfromfile() {      string result = "";     int countervalue = 0;     try {          inputstream inputstream = openfileinput("countvalue.txt");          if (inputstream != null) {              inputstreamreader inputstreamreader = new inputstreamreader(inputstream);             bufferedreader bufferedreader = new bufferedreader(inputstreamreader);              string tempstring = "";             stringbuilder stringbuilder = new stringbuilder();              while ((tempstring = bufferedreader.readline()) != null) {                  stringbuilder.append(tempstring);              }              inputstream.close();              result = stringbuilder.tostring();             countervalue = integer.parseint(result);          }       } catch (filenotfoundexception e) {         log.v("myactivity", "file not found" + e.tostring());     } catch (ioexception e) {         e.printstacktrace();     }     return countervalue; } 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -