Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to merge two imageview into one image in Android?
    primarykey
    data
    text
    <p>I'm creating an application for placing one image view on the another image view and made to single image and save into SD card. I run the application it creates image and save to SD card but this image is blank. Both images are not showing on one single image which is save in the SD card.</p> <p>Here is my code.</p> <pre><code>@SuppressWarnings("deprecation") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ImageView image2 = (ImageView) findViewById(R.id.ImageViewTwo); final ImageView image = (ImageView) findViewById(R.id.ImageViewOne); mTempDir = Environment.getExternalStorageDirectory()+"/"+"TestTemp"; File mtempFile = new File(mTempDir); if(!mtempFile.exists()) { mtempFile.mkdir(); } mSaveImageName = "Test.png"; mBackGround = Bitmap.createBitmap(100 , 100 ,Bitmap.Config.ARGB_8888); image2.buildDrawingCache(); mBackImage = image2.getDrawingCache(); mBackImage = Bitmap.createBitmap(100 , 100 ,Bitmap.Config.ARGB_8888); image.buildDrawingCache(); mTopImage = image.getDrawingCache(); mTopImage = Bitmap.createBitmap(100 , 100 , Bitmap.Config.ARGB_8888); mCanvas = new Canvas(mBackGround); //mCanvas.drawBitmap(mBackImage, (mCanvas.getWidth() / 2), 0, null); mCanvas.drawBitmap(mBackImage ,0f , 0f , null); mCanvas.drawBitmap(mTopImage, 12f , 12f , null); try { mBitmapDrawable = new BitmapDrawable(mBackGround); Bitmap mNewSaving = mBitmapDrawable .getBitmap(); String ftoSave = mTempDir + mSaveImageName; File mFile = new File(ftoSave); mFileOutputStream = new FileOutputStream(mFile); mNewSaving.compress(CompressFormat.PNG, 95 , mFileOutputStream); mFileOutputStream.flush(); mFileOutputStream.close(); } catch(FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.i(TAG, "Image Created"); } </code></pre>
    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