title: android: Save files in internal storage in a directory publicly
body: <p>I am trying to save images in a directory inside app file dir publicly. By publicly, I mean that I will be able to use action view intent on it.</p>
  
  <pre><code>/** Saves the bitmap to app storage */
      public int SaveBitmap(Bitmap bitmap, String filename, Boolean scan){
  
          // Save the file
          OutputStream os = null;
  
          String path = context.getFilesDir() + "/MyAppName/";
          File file = new File(path);
          if(!file.isDirectory())file.mkdirs();
          path += (filename + ".png");
          try {
              os = new BufferedOutputStream(new FileOutputStream(path,true));
              //os = mContext.openFileOutput(, Context.MODE_PRIVATE);
              bitmap.compress(CompressFormat.PNG, 100, os);
              os.flush();
              os.close();
              bitmap.recycle();
          } catch (IOException e) {
              e.printStackTrace();
              return 1; //Failure
          }
  
          File fileR = new File(path);
  
          fileR.setReadable(true, false);
          // Show in Gallery
          if(scan) ShowInGallery(filename);
  
          return 0; // SUCCESS
  
      }
  </code></pre>
  
  <p>This piece of code doesn't do the job, the files are still created in private mode.</p>
  
  <p>Using:</p>
  
  <pre><code>context.openFileOutput(filename + ".png", Context.MODE_WORLD_READABLE); 
  </code></pre>
  
  <p>I was able to open them publicly, but I cannot save the file in a directory in that.</p>
  
  <p>Note that I am targetting users that do not have SD cards, that is why I am not using External Storage.</p>
  
  <p>What can I do?</p>