直接上代码: public class RestClient { public static void main(String[] args) { String url = "http://ip地址/api/User/GetToken"; HttpClient client = new HttpClient(); //POST方法 PostMethod method = new PostMethod(url); //传递参数 NameValuePair[] data = { new N
public void httpClientGet(View view) { final String username = usernameEditText.getText().toString().trim(); final String password = passwrodEditText.getText().toString().trim(); //Android默认模拟器外部的地址为10.0.2.2,而不是localhost和127.0.0.1 final String server