简体   繁体   中英

A way to differentiate OnDismiss from dialogfragment - Android Studio

I need some help on somehow differentiate where the ondismiss are coming from. I'm using two different dialogfragments.

DialogClass1 dialog1 = new DialogClass1();
DialogClass2 dialog2 = new DialogClass2();


public void onDismiss(DialogInterface dialogInterface){

    if(dialogInterface.equals(dialog1){
         //CODE#
    }else if(dialogInterface == dialog2){
         //CODE#
    }

  )

Is there a way for this to work?

Thanks

如果两者的类型不同,请检查instanceOf。

if(dialogInterface instanceOf DialogInteface1){}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM