android - Activity isFinishing true after onPause -


i'm trying open alertdialog after opening activity , returning not through if.

code

listview.setadapter(new myadapter(this)); 

public class myadapter extends baseadapter {     private activity a;      public myadapter(activity a) {         this.a = a;     }      @override     public view getview(int pos, view view, viewgroup viewgroup) {         // other code          if (!((activity) a).isfinishing()) {             alertdialog.builder builder = new alertdialog.builder(a, r.style.dialog);             builder.settitle(a.getstring(r.string.dialog_share));             builder.setview(list);             builder.setnegativebutton(a.getstring(android.r.string.cancel), null);             dialog = builder.show();         }          // other code     } } 

usecase

  • adapter items
  • click 1 item (opens activity)
  • return first activity
  • try open dialog (code above used in baseadapter (item in listview has buttons))
  • nope

any ideas?

is activity "a" passed in constructor activity contains list? if yes, when click item , opens activity, activity goes process of finishing, making isfinishing return true. can try other ways check when user has return activity a, onactivityresult?


Comments