It's not tough. Just use alert Dialog and make sure that your views are right.
final Context context = this;
static final int SELECT_PICTURE = 1;
takeaphoto.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
LayoutInflater myLayout = LayoutInflater.from(context);
final View dialogView = myLayout.inflate(R.layout.YOURCUSTOM.XML, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
alertDialogBuilder.setView(dialogView);
final AlertDialog alertDialog = alertDialogBuilder.create();
Button button1 = (Button) dialogView.findViewById(R.id.button1);
button1.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, SELECT_PICTURE);
}});
alertDialog.show();
return;}});