基本上我已经在数据库端设置了一些成员,我还做了一个注册表单,它将数据发布到数据库,但我遇到的问题是我的程序不会启动活动。当我注释掉它的 httppost 部分时,它可以工作,所以我相信我的问题与 PHP 文件有关,但已经发布了我所做的 java 代码。在另一个问题中,我将发布 PHP 代码。
try
{
httpclient = new default HttpClient();
httppost = new HttpPost("");
nameValuePair = new arrayList < NameValuePair > (1);
nameValuePair . add(new BasicNameValuePair("email", email . getText() . toString() . trim()));
nameValuePair . add(new BasicNameValuePair("password", password . getText() . toString() . trim()));
httppost . setEntity(new UrlEncodedF or mEntity(nameValuePair));
response = httpclient . execute(httppost);
ResponseHandler < String > responseHandler = new BasicResponseHandler();
final Stringresponse = httpclient . execute(httppost, responseHandler);
loginErrorMsg . setText("" + response);
if(response . equalsIgnorecase ("Log in Successful"))
{
startActivity(new Intent(LoginActivity . this, HomescreenActivity . class ));
}
}
catch(Exceptione)
{
e.printStackTrace();
}