title: file saving on android
body: <p>I am making a xml file and saving it on my device code follows</p>
  
  <pre><code>HttpClient httpclient = new DefaultHttpClient();
          HttpPost httppost = new HttpPost("http://xx:xx:xx:xx:yy/LoginAndroid.asmx/login");
          httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
          HttpResponse response = httpclient.execute(httppost);
          String responseBody = EntityUtils.toString(response.getEntity());
          //Toast.makeText( getApplicationContext(),"responseBody:   "+responseBody,Toast.LENGTH_SHORT).show();
  
          //saving the file as a xml
          FileOutputStream fOut = openFileOutput("loginData.xml",MODE_WORLD_READABLE);
          OutputStreamWriter osw = new OutputStreamWriter(fOut);
          osw.write(responseBody);
          osw.flush();
          osw.close();
  
          //reading the file as xml
          FileInputStream fIn = openFileInput("loginData.xml");
          InputStreamReader isr = new InputStreamReader(fIn);
          char[] inputBuffer = new char[responseBody.length()];
          isr.read(inputBuffer);
          String readString = new String(inputBuffer);
  </code></pre>
  
  <p>FIle is saving I can also read the file every thing is ok but look at this line </p>
  
  <p><code>char[] inputBuffer = new char[responseBody.length()];</code></p>
  
  <p>it is calculating string length which is saved at the time of Saving the file.I am saving the file in one Acivity and reading it from another activity and my application will save the file locally once so I could not be able to get the length of that return string every time <strong>So is there any way to allocate the size of <code>char[] inputBuffer</code> dynamically?</strong></p>