title: saving file in internal storage android
body: <p>i'm new to android, and i'm having a problem when i'm trying to save a file into internal storage, the new example works on my sdk, but doesn't work on my phone. </p>
  
  <p>I'm trying to run de example in a sony Ericsson xperia, with android 2.1 by the way... the log.i - gives me the next line: </p>
  
  <pre><code>/data/data/com.example.key/files/text/(my_title) 
  </code></pre>
  
  <p>Thanks.</p>
  
  <pre><code>    @Override
          protected void onCreate(Bundle savedInstanceState) {
              // TODO Auto-generated method stub
              super.onCreate(savedInstanceState);
  
              setContentView(R.layout.new_text);
  
              file = (EditText) findViewById(R.id.title_new);
              entry = (EditText) findViewById(R.id.entry_new);
  
              btn = (Button) findViewById(R.id.save_new);
              btn.setOnClickListener( new OnClickListener() {
  
                  @Override
                  public void onClick(View v) {
  
                      File myDir = getFilesDir();
  
  
                      NEWFILENAME = file.getText().toString();
                      if (NEWFILENAME.contentEquals("")){
                          NEWFILENAME = "UNTITLED";
                      }
                      NEWENTRY = entry.getText().toString();
  
                      try {
  
                          File file_new = new File(myDir+"/text/", NEWFILENAME);
                          file_new.createNewFile();
  
                          Log.i("file", file_new.toString());
  
                          if (file_new.mkdirs()) {
                              FileOutputStream fos = new FileOutputStream(file_new);
  
                              fos.write(NEWENTRY.getBytes());
                              fos.flush();
                              fos.close();
                          }
  
                      } catch (FileNotFoundException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      } catch (IOException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
  
                      Intent textPass = new Intent("com.example.TEXTMENU");
                      startActivity(textPass);
                  }
              });
  
              }
  
  
   //That's for creating... then in other activity i'm reading
  
              @Override
          protected void onCreate(Bundle savedInstanceState) {
              // TODO Auto-generated method stub
              super.onCreate(savedInstanceState);
              setContentView(R.layout.text_menu);
  
              btn = (Button) findViewById(R.id.newNote);
              listfinal = (ListView) findViewById(R.id.listView);
  
              btn.setOnClickListener(new OnClickListener() {
  
                  @Override
                  public void onClick(View v) {
                      // TODO Auto-generated method stub
                      Intent textPass = new Intent("com.example.TEXTNEW");
                      startActivity(textPass);
  
                  }
              });
  
              listfinal.setOnItemClickListener(this);
  
              File fileWithinMyDir = getApplicationContext().getFilesDir();
  
  
              loadbtn = (Button) findViewById(R.id.loadList);
  
              loadbtn.setOnClickListener(new OnClickListener() {
  
                  @Override
                  public void onClick(View v) {
                      File myDir = getFilesDir();
  
                      File dir = new File(myDir + "/text/");
  
                      String[] files = dir.list();
  
                      //String[] files = getApplicationContext().fileList();
                      List&lt;String&gt; list = new ArrayList&lt;String&gt;();
  
                      for (int i =0; i &lt; files.length; i++){
                          list.add(files[i]);
                      }
                      ArrayAdapter&lt;String&gt; ad = new ArrayAdapter&lt;String&gt;(TextMenu.this,  android.R.layout.simple_list_item_1,
                                      android.R.id.text1, list);
  
                      listfinal.setAdapter(ad);
                  }
              });
              }
  </code></pre>
  
  <p>in my android manifiest i have the permissions</p>
  
  <pre><code>              &lt;uses-sdk
                      android:minSdkVersion="5"
                      android:targetSdkVersion="15" /&gt;
  
                  &lt;uses-permission android:name="android.hardware.camera" /&gt;
                  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
                  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
                  &lt;uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" /&gt;
  </code></pre>