-
Notifications
You must be signed in to change notification settings - Fork 168
5_set activity context (activity或context的设置)
水牛 edited this page Nov 17, 2017
·
1 revision
Normally
there is no need to set the activity when create a dialog ,because we can get the top activity by MyActyManager.getInstance().getCurrentActivity(), which is handled in the framework.
but in this case ,you should invoke the show() method in or after onResume() of the activity, or the dialog may show in previous activity.
一般情况下无需指定activity,框架会自动获取顶层activity,但是注意,dialog的show方法应该在本activity的onResume()之中或者之后调用,否则dialog会在前一个activity显示.
if you invoke show() in below callback ,please use set the certainty activity
- onCreate() or onStart() of activity
- onActivityResult() of a activity
.setActivity(this)