【问题标题】:Comparing values from httpclient to a String Android将 httpclient 中的值与字符串 Android 进行比较
【发布时间】:2012-03-22 07:58:16
【问题描述】:

我尝试将 mysql 数据库中的 http 响应值与本地字符串进行比较,但尽管字符串相同,但它失败了。我是否遗漏了什么,提示可能会有所帮助。

ResponseHandler<String> handleResponse = new BasicResponseHandler();

String phpEchoVal = httpclient.execute(httppost, handleResponse);

String containEmail = phpEchoVal.toString();

txtInfo = (TextView)findViewById(R.id.txtVInfo);

if ((containEmail.equals("success"))){
  txtInfo.setText(containEmail);
}else {
  txtInfo.setText("Exist");
}

【问题讨论】:

  • 你怎么知道它们是一样的?
  • Log.d("test","containEmail: "+containEmail);你很可能会明白为什么。
  • 日志给出 03-22 12:27:52.903: D/test(304): containsEmail: 。我相信没有分配containEmail 电子邮件。
  • @GrimJov 是的.. 就是这样.. 询问为什么没有分配它是一个完全不同的问题,我们需要查看更多您的请求代码以帮助您.. 尝试确保您的请求代码能够返回一个值尝试谷歌搜索 httpresponse sn-ps
  • 感谢您的确认!事实上,这很奇怪。当我敬酒包含电子邮件时,奇怪的是,它会通知我来自服务器的“成功”状态。 Toast.makeText(this, containsEmail, Toast.LENGTH_SHORT).show();

标签: php android httpclient


【解决方案1】:

您是否在清单文件中添加了互联网权限?

<uses-permission
        android:name="android.permission.INTERNET" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-02
    • 1970-01-01
    • 1970-01-01
    • 2017-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多