简体   繁体   English

Android:无法应用 AsyncTask 的 execute() 方法。 为什么?

[英]Android : execute() method of AsyncTask cannot be applied. Why?

The code:编码:

attemptLogin.execute(editName.getText().toString(),editPassword.getText(),"");

There is an error on the above line.上面一行有错误。

The code for AsyncTask is as follows: AsyncTask 的代码如下:

private class AttemptLogin extends AsyncTask<String, String, JSONObject> {

@override

There is an error on the override too.覆盖也有错误。

Replace @override with @Override .@override替换为@Override

Also replace attemptLogin.execute(editName.getText().toString(),editPassword.getText(),"");也替换attemptLogin.execute(editName.getText().toString(),editPassword.getText(),""); with attemptLogin.execute(editName.getText().toString(),editPassword.getText().toString(), obj);attemptLogin.execute(editName.getText().toString(),editPassword.getText().toString(), obj);

Note: In the third parameter, the obj should be of type "JSONObject".注意:在第三个参数中,obj 应该是“JSONObject”类型。 Please do send it as a parameter.请务必将其作为参数发送。 Replace "" by JSONObject instance.将 "" 替换为 JSONObject 实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM