android - How to show textview on Alert dialogue -


Hell I'm trying to make a warning conversation to show the highest point. But I can add textview to my conversation, the highest stores in textview Here's my code, when I click on the no button, I need to show textview.

  AlertDialog.bilder warningDialogBuilder = new alert.bilder (reference); // Set Headline DialogBuilder.setTitle ("Your Title"); // Set Dialogue Message Alert Dealbuilder. Setmasez ("Time has expired!") .Setacable (wrong) .set-positive button ("Restart!", New Dialog interface. OnClickLister Dialog Interface Dialog, Int ID) {// If this button is clicked, turn on / off activity App2Activity.this.finish ();}}) .setNegativeButton ("No", New DialogInterface.OnClickListener () {public void onClick (DialogInterface dialogue, int id) {// If this button is clicked, simply press the dialog Bus Do not get too close and some dialog.cancel ();}}); // Alert Dialog Warning Dialog = Alert DLObuilder Create (); // show it alert dialogue.show (); } }.Start();    

Create an XML file dialog_layout_pro.xml

  lt; Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: layout_width = "fill_parent" android: layout_height = "fill_parent" android: background = "# dedede" & gt; Android: Android: Android: layout_width = "wrap-content" Android: layout_height = "wrap-content" Android: layout_centerhoriginal = "true" Android: layout_centervertical = "true" Android: gravity = "center" Android: textColor = "# 444444 "Android: Text =" Please Wait ... "Android: Text Size =" 30sp "/> & Lt; / RelativeLayout & gt;   

and in the Java class

  {dialog] cusDialog; CusDialog = New Dialogue (MyTestClass.this, R.style.CustomDialog); cusDialog.setContentView (R.layout.dialog_layout_pro); Textview text = (textview) cusDialog.findViewById (R.id.tv_dialog); Text.setText ("Your Counter Value Here"); CusDialog.setCancelable (wrong); cusDialog.show (); }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -