应用程序适用于3G连接但不适用于Wi-Fi连接

时间:2017-11-02 13:29:57

标签: android connection

我正在使用php在mysql中创建注册用户 但问题是...当我使用3G时工作良好 但是,当我使用Wifi连接发布用户名和密码时..该应用程序无法正常工作,并且它很长时间没有响应.. 这是我的代码

        void loginnn() {
    new Thread(new Runnable() {
            public void run() {


    try {




        httpclient = new DefaultHttpClient();
        httppost = new HttpPost("http://ssss.esy.es/register.php"); 

        nameValuePairs = new ArrayList<>(2);

        nameValuePairs.add(new BasicNameValuePair("username", edts));
        nameValuePairs.add(new BasicNameValuePair("password", passs));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        response = httpclient.execute(httppost);
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        final String response = httpclient.execute(httppost, responseHandler);



        runOnUiThread(new Runnable() {
                public void run() {



                    }
            });

        if (response.equalsIgnoreCase("User Found")) { 
            runOnUiThread(new Runnable() {
                    public void run() { Toast.makeText(getApplicationContext(), "faild", Toast.LENGTH_SHORT).show();   

                    }
                });       } else {Toast.makeText(getApplicationContext(), "success", Toast.LENGTH_SHORT).show();        

        }

    } catch (Exception e) {
    }
            }}).start();
            }

0 个答案:

没有答案
相关问题