gpt4 book ai didi

android - 注册结束时发生 Logcat 错误

转载 作者:行者123 更新时间:2023-11-30 02:42:35 26 4
gpt4 key购买 nike

我无法注册到我的应用程序。因此我无法登录我的应用程序。下面我发布了与此相关的代码。

登录.java:

package com.steph.register;

public class Login extends Activity {


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set up the login form.
setContentView(R.layout.login);
mEmailView = (EditText) findViewById(R.id.email);
mPasswordView = (EditText) findViewById(R.id.password);
// Action listener to focus on the login process based on the key input.
mPasswordView
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id,
KeyEvent keyEvent) {
if (id == R.id.login || id == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
}
});


//Method to clear the registration details.
private void clearRegistrationCredinals() {
mRegisterEmailView.setText(null);
mRegisterPasswordView.setText(null);
mRegisterRePasswordView.setText(null);
}
}

}

然后我收到一条这样的日志猫消息:

日志:

10-06 10:18:22.722: D/SAM(1321): UserRegisterTask -> doInBackground
10-06 10:18:22.722: D/SAM(1321): http://********************************
10-06 10:18:22.732: D/keys->password_confirmation(1321): | value->*********
10-06 10:18:22.732: D/keys->password(1321): | value->*********
10-06 10:18:22.732: D/keys->email(1321): | value->ssteph9220@gmail.com
10-06 10:18:23.152: D/keys->username(1321): | value->ssteph9220@gmail.com
10-06 10:18:23.152: D/SAM->Json(1321): {"password_confirmation":"*********","password":"*********","email":"ssteph9220@gmail.com","username":"ssteph9220@gmail.com"}
10-06 10:18:23.482: D/dalvikvm(1321): GC_FOR_ALLOC freed 245K, 8% free 3936K/4256K, paused 33ms, total 34ms
10-06 10:19:27.462: E/SAM(1321): org.apache.http.conn.ConnectTimeoutException: Connect to /23.29.121.253:80 timed out
10-06 10:19:27.552: E/SAM(1321): org.json.JSONException: End of input at character 0 of
10-06 10:19:27.602: E/SAM(1321): java.lang.NullPointerException
10-06 10:19:27.672: D/SAM(1321): Server Reply -> Error
  • 但是 Logcat 错误没有指向任何行。我不知道怎么办解决这个问题。任何人都可以帮我解决这个问题。谢谢。

最佳答案

看到目前 api 不工作......

//Perform user registration task using AsyncTask in the background.
public class UserRegisterTask extends AsyncTask<Void, Void, String> {
@Override
protected String doInBackground(Void... params) {
Logger.debug("UserRegisterTask", "doInBackground");
try {
// String url = Settings.baseUrl + "users";
JSONObject oJSONObject = new JSONObject();
oJSONObject.put("email", mEmail);
oJSONObject.put("username", mEmail);
oJSONObject.put("password", mPassword);
oJSONObject.put("password_confirmation", mPassword);
//Make a Post method to create the new user.
// Users usr = JsonManager.parseUser(HttpManager.post(url,
// oJSONObject));
/*if (usr.getUserID() != 0) {
UserManager.setUserDetails(getApplicationContext(), usr);
return "Success";
}*/

} catch (Throwable th) {
Logger.error(th);
}
return "Success";
}

您没有初始化 usr 变量,但您正在尝试从中获取数据。所以我评论那个代码。现在可以了。

关于android - 注册结束时发生 Logcat 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25562767/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com