0

How would I change the colour of the text, when I select between the two options 'Gallery' and 'Camera'. I want them both to be orange. Also how would I add an icon/image to represent 'Gallery' and 'Camera', so when the icon is selected it would take me into the gallery so I can select an image, or I can take a picture using the camera.

public boolean onOptionsItemSelected(MenuItem item) {

        if (item.getItemId() == R.id.launch_voip_call) {
            Utils.startCall(this, contact);
            return true;
        } else if (item.getItemId() == R.id.launch_camera) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage("Pick Image from")
                    .setPositiveButton("Camera", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            //camera intent
                            Intent cameraIntent = new Intent(ConversationActivity.this, CameraActivity.class);
                            cameraIntent.putExtra("EXTRA_CONTACT_JID", contact.getJid());
                            startActivity(cameraIntent);
                        }
                    })
                    .setNegativeButton("Gallery", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            Intent intent = new Intent();
                            // Show only images, no videos or anything else
                            intent.setType("image/*");
                            intent.setAction(Intent.ACTION_GET_CONTENT);
                            // Always show the chooser (if there are multiple options available)
                            startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
                        }
                    });
            AlertDialog alert = builder.create();
            alert.show();
        }
}
Vukašin Manojlović
  • 3,717
  • 3
  • 19
  • 31
A.Samad
  • 13
  • 6
  • AlertDialog is not a goof option for that – xanexpt Feb 25 '16 at 11:25
  • Sorry why not? Thanks – A.Samad Feb 25 '16 at 11:28
  • 1
    you can costumize the alertdialog with themes, but i dont think is a good option. Try to use a DialogFragment, is more easy to costumise. http://stackoverflow.com/questions/20405070/how-to-use-dialog-fragment-showdialog-depreciated-android – xanexpt Feb 25 '16 at 11:47

0 Answers0