<string xmlns =“http://tempuri.org/”>&#34;用户已存在!&#34; </string>

时间:2016-06-24 07:40:13

标签: android

&#34;用户已经存在!&#34;如何获得像#34;用户已经存在的内在身体价值!&#34;我正在使用DOM Parser

请发布任何示例

1 个答案:

答案 0 :(得分:0)

 private EditText email, name, mobile, password;
TextView tv;
private Button submit;

// private String Email,Name,Mobile,Password;

    @Override
    protected void onCreate (Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        email = (EditText) findViewById(R.id.email);

        name = (EditText) findViewById(R.id.name);
        mobile = (EditText) findViewById(R.id.mobile);

        password = (EditText) findViewById(R.id.password);
        submit = (Button) findViewById(R.id.submit);

        submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String s1 = email.getText().toString().trim();

                String s2 = name.getText().toString().trim();
                String s3 = mobile.getText().toString().trim();

                String s4 = password.getText().toString().trim();
                if (s1.length() > 0 && s2.length() > 0) {
                    new ExecuteTask().execute(s1, s2, s3, s4);
                    email.setText(s1);

                    name.setText(s2);
                    mobile.setText(s3);


                    password.setText(s4);

                } else {

                }

            }
        });
    }



public String PostData(String[] valuse) {
    String responseText = "";
    try {
        HttpClient httpClient = new DefaultHttpClient();
        HttpGet httpPost = new HttpGet(
                "https://www.businessbook4u.com/bbm4u.asmx/XUsrSignup?Email="+valuse[0]+"&Name="+valuse[1]+"&Mobile="+valuse[2]+"&Password="+valuse[3]);

        HttpResponse response = httpClient.execute(httpPost);
        HttpEntity entity = response.getEntity();

        responseText = EntityUtils.toString(entity);

    } catch (Exception e) {
        System.out.println(e);
    }
    return responseText;
}
class ExecuteTask extends AsyncTask<String, String, String> {
    ProgressDialog pDialog;

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected String doInBackground(String... params) {
        String res = PostData(params);
        return res;
    }

    @Override
    protected void onPostExecute(String s) {
        super.onPostExecute(s);
        TextView t=(TextView)findViewById(R.id.message);
        t.setText(s);


       }
    }
}

}