Merge Image Overlay

package com.dansyosoftwares.mergeimages;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {

ImageView img;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

img=(ImageView) findViewById(R.id.mergedPhoto);
}

public void buttonMerge(View view) {

Bitmap bigImage = BitmapFactory.decodeResource(getResources(), R.drawable.img1);
Bitmap smallImage = BitmapFactory.decodeResource(getResources(), R.drawable.img2);
Bitmap mergedImages = createSingleImageFromMultipleImages(bigImage, smallImage);

img.setImageBitmap(mergedImages);
}

private Bitmap createSingleImageFromMultipleImages(Bitmap firstImage, Bitmap secondImage){

Bitmap result = Bitmap.createBitmap(firstImage.getWidth(), firstImage.getHeight(), firstImage.getConfig());
Canvas canvas = new Canvas(result);
canvas.drawBitmap(firstImage, 0f, 0f, null);
canvas.drawBitmap(secondImage, 10, 10, null);
return result;
}
}

<RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent”
android:layout_height=”match_parent”
tools:context=”.MainActivity”>

<FrameLayout
android:layout_width=”wrap_content”
android:layout_height=”300dp”
android:id=”@+id/frm”>

<ImageView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:id=”@+id/image”
android:src=”@drawable/img1″
/>

<ImageView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:id=”@+id/img1″
android:src=”@drawable/img2″
/>
</FrameLayout>

<Button
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_below=”@+id/frm”
android:text=”Merge Photos”
android:id=”@+id/merge”
android:onClick=”buttonMerge”
android:layout_centerInParent=”true”
/>
<ImageView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:layout_below=”@+id/merge”
android:id=”@+id/mergedPhoto”

/>

</RelativeLayout>

Game Resource Download
download.catcatgamer
Game Jobs/Freelancer/Projects
jobs
AppleMusicPro.org
applemusicpro.org