a7omiton
a7omiton

Reputation: 1617

Custom Dialog not displaying - Android

I'm trying to pop up a custom dialog when I click on a button but it won't pop up at all. my app is basically a calendar and I'm going to use sqlite to add/hold appointments and stuff to a date in the calendar using the dialog, which is where the appointment details will be specified.

The code I'm using for this is the following:

public void onClick(View v) {
        // TODO Auto-generated method stub
        //long a = calendar.getDate();
        switch(v.getId()){
        case R.id.createButton:
            openCreateAppointmentDialog();
            break;
        }
    }

    private void openCreateAppointmentDialog(){
        Context mContext = getApplicationContext();
        Dialog createAppmntDialog = new Dialog(mContext);

        createAppmntDialog.setContentView(R.layout.create);
        createAppmntDialog.setTitle(R.string.createTitle);

        appointmentTitle = (EditText) createAppmntDialog.findViewById(R.id.titleTextBox);
        appointmentTitle.setText("hello");

        appointmentTime = (EditText) createAppmntDialog.findViewById(R.id.timeTextBox);

        appointmentDetails = (EditText) createAppmntDialog.findViewById(R.id.detailsTextBox);

        saveAppointment = (Button) createAppmntDialog.findViewById(R.id.saveButton);
        saveAppointment.setOnClickListener(this);
    }

What am I doing wrong?

Upvotes: 0

Views: 760

Answers (1)

user
user

Reputation: 87064

Call the show() method for your dialog.

createAppmntDialog.show(); //when you want the dialog to appear on the screen

Upvotes: 3

Related Questions