java - Activity which implements multiple dialog listeners? -


I'm getting confused with the dialog boxes in the Android and need some advice.

Everything was good at the beginning. Many dialogs have been created within me, which has been opened through a new draw. By the use of code lines is designed very simply:

  private void Export dialog () {layout Inflettr Infletr = this.getLayoutInflater (); See lastLimension View = inflater.inflate (R.layout.export_data, empty, incorrect); AlertDialog MsgBox = new AlertDialog.Builder (it) .setView (formElementsView) .setTitle ( "Export answers") .setIcon (android.R.drawable.ic_menu_share) .setPositiveButton ( "OK", the new DialogInterface.OnClickListener () {public Zero OnClick (DialogInterface dialog, int joe) {// code ...}} .create (); MsgBox.show (); }  

But when I restarted the device from the lock screen, I started reporting problems. Switching started / stopped / started, but the lock screen activity seemed to hit the context and when the app resume the graphing interface became corrupt and I got the error message "Activity window leaked" in the log is.

So, I started again I moved DialogFragment classes all dialogues, which seems to be 'proper' way to do it. It removes error and graphical delays great!

But I can not work out how to add more dialogue listener from one Menaktiviti so I got it:

  implements public square MainActivity extends Activity the'd LogInDialog.NoticeDialogListener { 

but I can add more

as long as I work to do this, I have changed the way many of the main activities And transferred them to relevant dialogue sections, which are fine Program does but does not seem mere linear perspective it would be nice if MainActivity can act on each dialog response.

You can guess, I am not a professional developer therefore I'm rather lost!

Update:

OK, it seems original because the dialog boxes were not being dismissed correctly graphic There was a problem of flaws and "leaking window" messages. Adding the following has improved a lot:

  @Override Public Zero at Destroy () {super.onDestroy (); If (DialogBox1! = Null) {DialogBox1.dississ (); } DialogBox1 = Faucet; If (DialogBox2! = Null) {DialogBox2.dismiss (); } DialogBox2 = Faucet; If (DialogBox3! = Null) {DialogBox3.dismiss (); } DialogBox3 = Faucet; ...  

loginregell Use the internal sections that apply the notice dialog listener


Comments