【发布时间】:2016-01-01 18:37:16
【问题描述】:
EditInformation 扩展到片段。我在这一行得到错误
loading = ProgressDialog.show(EditInformation.this,"Fetching...","Wait...",false,false);,第一个参数类型错误。
public void RetrieveInformation(final String id)
{
class GetEmployee extends AsyncTask<Void,Void,String> {
ProgressDialog loading;
@Override
protected void onPreExecute() {
super.onPreExecute();
loading = ProgressDialog.show(EditInformation.this,"Fetching...","Wait...",false,false);
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
loading.dismiss();
showEmployee(s);
}
@Override
protected String doInBackground(Void... params) {
RequestHandler rh = new RequestHandler();
String s = rh.sendGetRequestParam(Config.RETRIEVE_INFORMATION,id);
return s;
}
}
GetEmployee ge = new GetEmployee();
ge.execute();
}
错误
Error:(124, 62) error: incompatible types: EditInformation cannot be converted to Context
我更改为 EditInformation.getActivity(),但收到错误 non-static method
【问题讨论】:
-
只是 getActivity()....
标签: java android android-fragments fragment