KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm creating a custom dialog containing an EditText so that I can get text data from the user: final EditText newKey = (EditText) findViewById(R.id.dialog_result); AlertDialog.Builder keyBuilder = new AlertDialog.Builder(StegDroid.this); keyBuilder .setCancelable(false) .setPositiveButton("Try Again", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Log.v("Dialog","New Key: "+newKey.getText().toString()); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog dialog = keyBuilder.create(); dialog.setTitle("Decryption Failed"); dialog.setContentView(R.layout.decrypt_failed_dialog); dialog.show(); However I always get this exception: 01-11 18:49:00.507: ERROR/AndroidRuntime(3461): android.util.AndroidRuntimeException: requestFeature() must be called before adding content 01-11 18:49:00.507: ERROR/AndroidRuntime(3461): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:181) 01-11 18:49:00.507: ERROR/AndroidRuntime(3461): at com.android.internal.app.AlertController.installContent(AlertController.java:199) 01-11 18:49:00.507: ERROR/AndroidRuntime(3461): at android.app.AlertDialog.onCreate(AlertDialog.java:251) ... at the line of dialog.show() . What should I be doing to get rid of this?
Tags (comma-separated)
Save Edits
Cancel