Link to home
Start Free TrialLog in
Avatar of allelopath
allelopath

asked on

DialogFragment with Text box

Below is code for a dialog with one button. I want to add a text box with text to this. How is this done?

import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.app.DialogFragment;

@TargetApi(11) public class HelpDialog extends DialogFragment {

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		// Use the Builder class for convenient dialog construction
		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
		
		builder.setMessage(R.string.help)
        .setCancelable(false) // one button only
		.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
			
			}
		});

		// Create the AlertDialog object and return it
		return builder.create();
	}

}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Harte
Chris Harte
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of allelopath
allelopath

ASKER

That does pretty much the same as what I posted, but I've realized that I've asked the wrong question. Will post another.