Q:

Why am I unable to get a Dialog when clicking the image?

I want the user to choose that whether they'd like to take picture or choose one from gallery. 
I set up an OnClickListener on my Image but when I'm clicking the image, nothing is happening.
Here is my SettingUpUserProfile.java file's code:
public class SettingUpUserProfile extends AppCompatActivity {

    public static final int TAKE_PHOTO_REQUEST = 0;
    protected ImageView userProfilePicture;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting_up_user_profile);

        userProfilePicture = (ImageView) findViewById(R.id.userProfilePicture);
        userProfilePicture.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AlertDialog.Builder builder = new AlertDialog.Builder(SettingUpUserProfile.this);
                builder.setTitle(null);
                builder.setItems(R.array.pickImage_options, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int position) {
                        switch (position) {
                            case 0:
                                Intent intentCaptureFromCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                                startActivityForResult(intentCaptureFromCamera, TAKE_PHOTO_REQUEST);
                                break;
                            case 1:
                                // Choose from gallery.
                        }
                    }
                });
            }
        });

    }
}

and here is my activity_setting_up_user_profile.xml file's code:
<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"
    android:background="@color/light_purple"
    tools:context="com.abc.xyz.SettingUpUserProfile">

    <TextView
        android:id="@+id/settingUpUserProfileText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="40dp"
        android:text="@string/settingUpUserProfileText1"
        android:textColor="@color/white"
        android:textStyle="bold"
        android:textSize="30sp"
        android:gravity="center_horizontal|center_vertical"/>

    <ImageView
        android:id="@+id/userProfilePicture"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/settingUpUserProfileText1"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:layout_marginTop="100dp"
        android:clickable="true"
        android:src="@drawable/ic_face_white_48dp" />

    <TextView
        android:id="@+id/settingUpUserProfileText2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/userProfilePicture"
        android:layout_marginTop="5dp"
        android:text="@string/settingUpUserProfileText2"
        android:textColor="@color/white"
        android:textSize="15sp"
        android:gravity="center_horizontal|center_vertical"/>

    <EditText
        android:id="@+id/userName"
        android:background="@drawable/phone_number_edit_text_design"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/settingUpUserProfileText2"
        android:layout_marginTop="80dp"
        android:layout_marginLeft="10dp"
        android:layout_marginStart="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginEnd="10dp"
        android:gravity="center_horizontal|center_vertical"
        android:hint="@string/hint_userName"
        android:textColor="@color/white"
        android:textColorHint="#E0E0E0"
        android:textCursorDrawable="@null"
        android:inputType="textPersonName"/>

    <Button
        android:id="@+id/buttonAllSet"
        android:background="@color/white"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/userName"
        android:layout_marginTop="20dp"
        android:text="@string/button_allSet"
        android:textStyle="bold"
        android:textColor="@color/light_purple"
        android:layout_marginEnd="120dp"
        android:layout_marginStart="120dp"
        android:gravity="center_horizontal|center_vertical"/>

</RelativeLayout>

I'm really unable to figure out what is wrong here.
Kindly, let me know.
I'm new to StackOverflow so please cooperate.
Thanks in advance.

A:

Add Below lines to your onClick() method
AlertDialog alertDialog = builder.create();
alertDialog.show();

