android - Creating own dialog class, String reference problems with R.java -


I'm just creating a square that's a simple "Do you want to get out?" Dialogues for each of my activities are in my application, and I have some questions. I am starting with opaque, so do not be mad.

So this is my Nicolagrid class:

  Expands the public class ExitDialog dialog OnClickListener {Personal button dialog; Cancel personal button dialog; Private text view dialog text; Exit Public (Reference Reference) {Super (Reference); Last Dialogue Dialog = New Dialogue (Reference, R. Style. Delogennim); Dialog.requestWindowFeature (Window.FEATURE_NO_TITLE); Dialog.setContentView (R.layout.exitdialog); DialogOk = (button) dialog.findViewById (R.id.dialogOk); DialogCancel = (button) dialog.findViewById (R.id.dialogCancel); DialogText = (TextView) dialog. Fix ViewById (R.id.dialogText); // How to reach any reference from RJA? // // Dialliog oak .Set Text (Get String (R. String Yes)); //ialogText.setText(getString (R.string.Exit)); DialogOk.setOnClickListener (this); DialogCancel.setOnClickListener (this); Dialog.show (); } @ Override Public Wide OnClick Onclick (see V) {// Many people have replied, that I have to compare two of these two ideas to use ** IIID (), but I can do this Yes, because I got a message in the log-in! // but rejected () simply is not said ... if (V == dialogue oak) {Log.i ("ExitDialog", "DialogOk clicked"); This.dismiss (); }}}   

I have 3 questions for you:

How can I access R.java file for strong references of my application ? As you see, I have commented on getString (R.string.Yes) and getString (R.string.Exit) functions because I use it in this external class

The second question is if there is a suggestion about .dismiss () . If I call this.dismiss () So, my dialogue does not just go away, it remains on the screen, why does this happen? How to dismiss?

The third question is how to get parental activity from this external dialogue class? I need to call .finish () for this, so my app can get out.

Any suggestions would be greatly appreciated. Thank you.

Do not extend your activity through conversations, increase it from activity. Call normally. But in the manifest file, add the following line under your Dialog Activity:

  android: theme = "@ android: style / theme.Dialog"   

And look up the above mentioned content: request WindowFeature (Window.FEATURE_NO_TITLE);

You can normally call and dismiss resources () in normal form.

  button.setOnClickListener (click on Public Zero (see V) {intent = new intent (YourActivityName.this, DialogClass.class); StartActivity;}}); Dialogue Activity:  
  Public class increases DialogClass activity ) {// Todo auto-generated method stub superconet (saved instenstate); requestWindowFeature (Window.FEATURE_NO_TITLE); setContentView (R.layout.custom); button = (button) findViewById (R.id.cancel) The; // xml file belongs to the button. Click on the SOCOClicklist (new OnListList () {click on Public Zero (See V) {end ();}}); TextView = (TextView) findViewById (R.id.ttt); //// xml file is related to text View.setText (R.string.app_name);} }    

Comments