title: Storing image to internal storage
body: <p>I want to store my images to internal storage, I searched google and stackoverflow but couldn't get it done, Here is my code:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
      imageView = (ImageView) findViewById(R.id.ss);
      tv = (TextView) findViewById(R.id.tv);
     // Firebase.setAndroidContext(this);
      //Firebase ref = new Firebase(FIREBASE_URL);
  
      Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
      startActivityForResult(i, RESULT_LOAD_IMAGE);
  }
  
  
  
  protected void onActivityResult(int requestCode, int resultCode, Intent data)
  {
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data)
      {
          Uri selectedImage = data.getData();
          String[] filePathColumn = { MediaStore.Images.Media.DATA };
  
          Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
          cursor.moveToFirst();
  
          int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
          String picturePath = cursor.getString(columnIndex);
          cursor.close();
          bitmap = BitmapFactory.decodeResource(getResources(),
                  RESULT_LOAD_IMAGE);
  
          // Find the SD Card path
          File filepath = Environment.getExternalStorageDirectory();
  
          // Create a new folder in SD Card
          File dir = new File(filepath.getAbsolutePath()
                  + "/Save Image Tutorial/");
          dir.mkdirs();
  
          // Create a name for the saved image
          File file = new File(dir, "myimage.png");
  
          // Show a toast message on successful save
          Toast.makeText(MainActivity.this, "Image Saved to SD Card",
                  Toast.LENGTH_SHORT).show();
          try {
  
              output = new FileOutputStream(file);
  
              // Compress into png format image from 0% - 100%
              bitmap.compress(Bitmap.CompressFormat.PNG, 100, output);
              output.flush();
              output.close();
          }
  
          catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
  
      }
  
         // drawView.load_pic(picturePath);
      }
  }
  </code></pre>
  
  <p>I want to get an image from the gallery and store it to internal storage but in this code, it is only saving the name of the file in the directory. If someone could help me to solve this.</p>