add method to determine if current activity is null
Reviewed By: andreicoman11 Differential Revision: D2680281 fb-gh-sync-id: ac158fb55dd60d05b7e3444d68e06a010e04eef4
This commit is contained in:
parent
90de853cc1
commit
56a56f33d1
|
@ -225,15 +225,17 @@ public class ReactContext extends ContextWrapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasCurrentActivity() {
|
||||||
|
return mCurrentActivity != null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as {@link Activity#startActivityForResult(Intent, int)}, this just redirects the call to
|
* Same as {@link Activity#startActivityForResult(Intent, int)}, this just redirects the call to
|
||||||
* the current activity. Returns whether the activity was started, as this might fail if this
|
* the current activity. Returns whether the activity was started, as this might fail if this
|
||||||
* was called before the context is in the right state.
|
* was called before the context is in the right state.
|
||||||
*/
|
*/
|
||||||
public boolean startActivityForResult(Intent intent, int code, Bundle bundle) {
|
public boolean startActivityForResult(Intent intent, int code, Bundle bundle) {
|
||||||
if (mCurrentActivity == null) {
|
Assertions.assertNotNull(mCurrentActivity);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
mCurrentActivity.startActivityForResult(intent, code, bundle);
|
mCurrentActivity.startActivityForResult(intent, code, bundle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue