title: combine two bitmap and save as one image
body: <p>I am trying to combine two bitmaps and set it into imageview and also save that bitmap when i click button,but when i combine bitmap set it into image at that time it shows second bitmap bigger than it's real size.here is my code:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          getBitmap(image1);
          Bitmap drawingBitmap = Bitmap.createBitmap(parts.getWidth(),
                              parts.getHeight(),Bitmap.Config.ARGB_8888);
          canvas = new Canvas(drawingBitmap);
  
          canvas.drawBitmap(parts,0,0,null);
          canvas.drawBitmap(touch,0,0,null);
  
          bit=drawingBitmap;
  
          public void getBitmap(View v) {
              Bitmap bitmap= Bitmap.createBitmap(v.getWidth(),v.getHeight(), Bitmap.Config.ARGB_8888);
              Canvas c = new Canvas(bitmap);
              v.draw(c);
  
          touch=bitmap;
      }
  
      Button btn = (Button) findViewById(R.id.button);
  
      btn.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              SaveImage save = new SaveImage();
              save.Save(getApplicationContext(),bit);
          }
      });
  
  }
  </code></pre>
  
  <p>here <strong>parts</strong> is bitmap for hold camera picture and <strong>image1</strong> is dynamically created imageview.</p>
  
  <p>SaveImage.java</p>
  
  <pre><code>package com.example.tattoodesign;
  
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.Calendar;
  
  import android.content.Context;
  import android.graphics.Bitmap;
  import android.graphics.Canvas;
  import android.graphics.Paint;
  import android.media.MediaScannerConnection;
  import android.net.Uri;
  import android.os.Environment;
  import android.widget.Toast;
  
  public class SaveImage {
  
      private Context TheThis;
      private String NameOfFolder = "/PaintImage";
      public String NameOfFile = null;
      //private ArrayList&lt;Bitmap&gt; images = null;
  
       public void Save(Context context,Bitmap ImageToSave){
              TheThis = context;
              String file_path = Environment.getExternalStorageDirectory().getAbsolutePath()+ NameOfFolder;
              String CurrentDateAndTime= getCurrentDateAndTime();
              File dir = new File(file_path);
              NameOfFile="PaintImage"+CurrentDateAndTime+ ".jpg";
  
              if(!dir.exists()){
                 dir.mkdirs();
              }
  
              File file = new File(dir,NameOfFile);
              if (file.exists ()) file.delete ();
              try {
                  FileOutputStream fOut = new FileOutputStream(file);
                  ImageToSave.compress(Bitmap.CompressFormat.JPEG, 85, fOut);
                  fOut.flush();
                  fOut.close();
                  MakeSureFileWasCreatedThenMakeAvabile(file);
  
              }
              catch (FileNotFoundException e) {
                  UnableToSave();}
              catch (IOException e){
                  UnableToSave();
              }
  
          }
  
      private void MakeSureFileWasCreatedThenMakeAvabile(File file) {
          MediaScannerConnection.scanFile(TheThis,
                  new String[] { file.toString() }, null,
                  new MediaScannerConnection.OnScanCompletedListener() {
                      public void onScanCompleted(String path, Uri uri) {
                      }
                  });
  
      }
  
      private String getCurrentDateAndTime() {
          Calendar c = Calendar.getInstance();
          SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
          String formattedDate = df.format(c.getTime());
          return formattedDate;
      }
  
      private void UnableToSave() {
          Toast.makeText(TheThis, "Picture cannot to gallery", Toast.LENGTH_SHORT)
                  .show();
  
      }
    }
  </code></pre>
  
  <p>how can i fix this problem?</p>
  
  <p>any help would be appreciate.</p>
  
  <p>Thanks.</p>