Android Write / Read Text
<p>Hey guys, I have this code for an android application, the funny thing is that data is never equal to datas, can you guys explain me why, and if in case give me new read / write file functions :/ , thanks</p>

<pre><code>   String datas = "volume of";
    writesettings(datas);
    String data = readsettings();
    String data2 = "volume of";
    if (data == datas) {
     System.out.println("success");
    }
    System.out.println(data);
    System.out.println(data.length());
    System.out.println(datas.length());
}
// Write Settings
public void writesettings(String data){ 
    try {      
  FileOutputStream fOut = openFileOutput("settings.dat", MODE_WORLD_READABLE);
  OutputStreamWriter osw = new OutputStreamWriter(fOut); 
  osw.write(data);
  osw.flush();
  osw.close();
 }catch(Exception e){
  e.printStackTrace(System.err);
 }
}
public String readsettings(){
 try {
  FileInputStream fIn = openFileInput("settings.dat");
  InputStreamReader isr = new InputStreamReader(fIn);
  char[] inputBuffer = new char[9];
  isr.read(inputBuffer);
  String readString = new String(inputBuffer);
  datax = readString;
  isr.close();
 } catch (IOException ioe) {
  ioe.printStackTrace();
 }
 return datax;
}
</code></pre>
