AsyncHttpClient client = new AsyncHttpClient();
运行到这一句之后就闪退,有没有大佬知道是怎么回事?
以下是这个片段的代码:
public void sendAsyncHttpClient(String string){
try{
String path="http;//192.168.1.1";
AsyncHttpClient client = new AsyncHttpClient();
RequestParams params=new RequestParams();
params.put("data",string);
client.post(path, params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int i, Header[] headers, byte[] bytes) {
Toast.makeText(NFCmain.this, "Onsuccess", Toast.LENGTH_SHORT).show();
log.e("onSuccess",new String(bytes));
}
@Override
public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
Toast.makeText(NFCmain.this, "OnFailure", Toast.LENGTH_SHORT).show();
}
});
}catch(Exception e){
e.printStackTrace();
}
}