我用 fragment_navigator
创建片段但是我想工作 processDialog ,我遇到了这个错误
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources$Theme android.content.Context.getTheme()' on a null object reference
at androidx.navigation.fragment.FragmentNavigator$Destination.createFragment(FragmentNavigator.java:353)
代码:
...
PerformNetworkRequest request = new PerformNetworkRequest(Api.URL_READ, null, CODE_GET_REQUEST,getContext());
request.execute();
...
PerformNetworkRequest(String url, HashMap<String, String> params, int requestCode, Context context) {
this.url = url;
this.params = params;
this.requestCode = requestCode;
this.context = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
p = new ProgressDialog(context);
p.setMessage("bla bla"); ...