Displaying custom dialog
<p>Alright, so I would like to have a custom dialog, but I cannot figure out for the life of me how to make it appear when the function is called.</p>

<pre><code>public void addHomework() {
    final Dialog alert = new Dialog(this);  

    alert.setTitle("Add Homework");

    alert.setContentView(R.layout.homework_item_entry);

    Button add_button = (Button) findViewById(R.id.add_homework_button);
    Button cancel_button = (Button) findViewById(R.id.cancel_homework_button);

    add_button.setOnClickListener( new OnClickListener() {
        public void onClick(View v) {
            Toast.makeText(ClassHomeworkList.this, "Adding homework", Toast.LENGTH_SHORT).show();
        }
    });

    cancel_button.setOnClickListener( new OnClickListener() {
        public void onClick(View v) {
            alert.dismiss();
        }
    });

    alert.show();
}
</code></pre>

<p>What could I do?</p>
