[英]Error:(124, 9) error: method does not override or implement a method from a supertype
I'm trying to develop a complete android login registration system with PHP and MySQL from Android. 我正在尝试使用来自Android的PHP和MySQL开发一个完整的android登录注册系统。 If user forget his password, a new password will be send to his e-mail.
如果用户忘记了密码,新密码将发送到他的电子邮件中。 I follow this tutorial .
我遵循本教程 。
ForgetPassword 忘记密码
email = (EditText) findViewById(R.id.forpas);
forgetPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if ((name.getText().toString().trim().length() == 0) || (email.getText().toString().trim().length() == 0)) {
Toast.makeText(getApplicationContext(), "Name or E-mail cannot be null", Toast.LENGTH_LONG).show();
return;
} else {
NetAsync();
}
}
});
private class NetCheck extends AsyncTask
{
private ProgressDialog nDialog;
@Override
protected void onPreExecute(){
super.onPreExecute();
nDialog = new ProgressDialog(ForgetPassword.this);
nDialog.setMessage("Loading..");
nDialog.setTitle("Checking Network");
nDialog.setIndeterminate(false);
nDialog.setCancelable(true);
nDialog.show();
}
@Override
protected Boolean doInBackground(String... args){
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnected()) {
try {
URL url = new URL("http://www.google.com");
HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
urlc.setConnectTimeout(3000);
urlc.connect();
if (urlc.getResponseCode() == 200) {
return true;
}
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;
}
@Override
protected void onPostExecute(Boolean th){
if(th == true){
nDialog.dismiss();
new ProcessRegister().execute();
}
else{
nDialog.dismiss();
Toast.makeText(getApplication(),"Error in Network Connection",Toast.LENGTH_LONG).show();
//alert.setText("Error in Network Connection");
}
}
}
private class ProcessRegister extends AsyncTask {
private ProgressDialog pDialog;
String forgotpassword;
@Override
protected void onPreExecute() {
super.onPreExecute();
forgotpassword = email.getText().toString();
pDialog = new ProgressDialog(ForgetPassword.this);
pDialog.setTitle("Contacting Servers");
pDialog.setMessage("Getting Data ...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
@Override
protected JSONObject doInBackground(String... args) {
UserFunction userFunction = new UserFunction();
JSONObject json = userFunction.forPass(forgotpassword);
return json;
}
@Override
protected void onPostExecute(JSONObject json) {
/**
* Checks if the Password Change Process is sucesss
**/
try {
if (json.getString(KEY_SUCCESS) != null) {
//alert.setText("");
String res = json.getString(KEY_SUCCESS);
String red = json.getString(KEY_ERROR);
if(Integer.parseInt(res) == 1){
pDialog.dismiss();
// alert.setText("A recovery email is sent to you, see it for more details.");
Toast.makeText(getApplication(),"A recovery email is sent to you, see it for more details",Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplication(),"Error",Toast.LENGTH_LONG).show();
}
}}
catch (JSONException e) {
e.printStackTrace();
}
}}
Error 错误
Error:(108, 13) error: ForgetPassword.NetCheck is not abstract and
does not override abstract method doInBackground(Object...) in
AsyncTask Error:(124, 9) error: method does not override or implement
a method from a supertype Error:(164, 13) error:
ForgetPassword.ProcessRegister is not abstract and does not override
abstract method doInBackground(Object...) in AsyncTask
You haven't provided any types for AsyncTask
when declaring NetCheck
, but are trying to override doInBackground(String... args)
, change it to: 声明
NetCheck
,您没有提供AsyncTask
任何类型,但尝试覆盖doInBackground(String... args)
,将其更改为:
private class NetCheck extends AsyncTask<String, Integer, Boolean>
likewise change the declaration of ProcessRegister
to: 同样,将
ProcessRegister
的声明更改为:
private class ProcessRegister extends AsyncTask<String, Integer, JSONObject>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.