Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot save the merged images in proper position
    primarykey
    data
    text
    <p>I am new to android.Trying first time this code. I am saving three images, two images are small and one is large. I am trying to adjust the small ones position on large and merge that image into one but as I am clicking on the done button it is not saved properly on the position which I select for small image. I am moving the small image n large image and trying to save the image at that position where I stop. Making an photo editor like app.</p> <p>My code is: For Save button</p> <pre><code>case R.id.bdone: mTempDir = Environment.getExternalStorageDirectory()+"/";//location File mtempFile = new File(mTempDir); if(!mtempFile.exists()) { mtempFile.mkdir(); } mSaveImageName = "Test.jpg";//name of image to be merged //myImage.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); //myImage.layout(0, 0, myImage.getMeasuredWidth(), myImage.getMeasuredHeight()); myImage.buildDrawingCache(); myBitmap = myImage.getDrawingCache(); myImage1.buildDrawingCache(); myBitmap1 = myImage1.getDrawingCache(); myImage2.buildDrawingCache(); myBitmap2 = myImage2.getDrawingCache(); Bitmap mBackground = Bitmap.createBitmap(myBitmap.getWidth(),myBitmap.getHeight(),myBitmap.getConfig()); myImage.setImageBitmap(mBackground);//Main bitmap mCanvas = new Canvas(mBackground); mCanvas.drawBitmap(myBitmap ,new Matrix(), null); mCanvas.drawBitmap(myBitmap1,x-dx,y-dy, null); mCanvas.drawBitmap(myBitmap2,x-dx,y-dx, null); try { mBitmapDrawable = new BitmapDrawable(mBackground); Bitmap mNewSaving = mBitmapDrawable .getBitmap(); String ftoSave = mTempDir + mSaveImageName; File mFile = new File(ftoSave); Random generator = new Random(); int n = 10000; n = generator.nextInt(n); FileOutputStream out = new FileOutputStream(mFile); mNewSaving.compress(CompressFormat.JPEG,100, out); Toast.makeText(getApplicationContext(), "Image Saved",Toast.LENGTH_SHORT).show(); out.flush(); out.close(); } catch(FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } break; </code></pre> <p>Please answer my question as soon as possible.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload