title: write and read configuration data using File operation in Android
body: <p>In my application there are some configuration data, such as ipaddress, portno, title and etc.  I want to keep these data in phone privately.  I decided to write data in below format</p>
  
  <pre><code>IPAddress=127.0.0.1
  Port=1234
  Title=MyNewApplication
  </code></pre>
  
  <p>i am confused with file streams.  I also want to update values without using a temperory file.  Please provide a solution to this.</p>
  
  <p>I tried with below code</p>
  
  <pre><code>public class Mtx {
  
  public static final String PREFS_NAME = "MyPrefsFile";
  
  public static void ConfWrite(String type, String value) {
      SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(null);
      SharedPreferences.Editor editor = settings.edit();
      editor.putString("IPAddress", "127.0.0.1");
      editor.putInt("port", 1234);
      editor.putString("Title", "MyNewApplication");
  
      // Commit the edits!
      editor.commit();
  }
  
  public static void ConfRead( String type, String value ) {
  
          SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(null);
          String ipAddress = settings.getString("IPAddress", "");
          int port = settings.getInt("port", 0);
          String title = settings.getString("Title", "");
  
          Log.e("", title);
  }
  }
  </code></pre>