Android 离子库json查询
我正在制作应用程序,只是因为json它在整个json上使用了“”逗号,所以我的请求失败了,所以请检查代码并帮助我 谢谢Android 离子库json查询,android,json,Android,Json,我正在制作应用程序,只是因为json它在整个json上使用了“”逗号,所以我的请求失败了,所以请检查代码并帮助我 谢谢 newandroid.os.Handler().postDelayed( 新的Runnable(){ public void run(){ JSONObject jsobj=新的JSONObject(); JSONObject jsobj1=新的JSONObject(); 试试{ jsobj1.put(“mobile”,_mobileText.getText().toStrin
newandroid.os.Handler().postDelayed(
新的Runnable(){
public void run(){
JSONObject jsobj=新的JSONObject();
JSONObject jsobj1=新的JSONObject();
试试{
jsobj1.put(“mobile”,_mobileText.getText().toString());
jsobj1.put(“s”,“付款”);
jsobj1.put(“cl”、“样本客户”);
jsobj.put(“pa”,jsobj);
}捕获(JSONException e){
e、 printStackTrace();
}
Ion.with(SignupActivity.this)
.load(“POST”,UrlConfigFile.BASE\u URL)
.addHeader(“内容类型”、“应用程序/json”)
.addHeader(“客户机密钥”、“示例客户端”)
.asJsonObject()
.setCallback(新的FutureCallback(){
@凌驾
未完成公共无效(异常e,JsonObject结果){
如果(e!=null)
{
Toast.makeText(SignupActivity.this,“失败”,Toast.LENGTH_SHORT.show();
}否则
{
Toast.makeText(SignupActivity.this,“working”+result.toString(),Toast.LENGTH\u SHORT.show();
onSignupSuccess();
}
}
});
//onSignupFailed();
progressDialog.disclose();
}
}, 3000);
json应该是这样的
{
“对象”:{
“键”:“值”,
“键”:“值”
},
“键”:“值”
}
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
JSONObject jsobj=new JSONObject();
JSONObject jsobj1=new JSONObject();
try {
jsobj1.put("mobile",_mobileText.getText().toString());
jsobj1.put("s","payment");
jsobj1.put("cl","sample_client");
jsobj.put("pa",jsobj);
} catch (JSONException e) {
e.printStackTrace();
}
Ion.with(SignupActivity.this)
.load("POST", UrlConfigFile.BASE_URL)
.addHeader("Content-Type","application/json")
.addHeader("clientKey","sample_client")
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
if(e!=null)
{
Toast.makeText(SignupActivity.this, "Failed", Toast.LENGTH_SHORT).show();
}else
{
Toast.makeText(SignupActivity.this, "working "+result.toString(), Toast.LENGTH_SHORT).show();
onSignupSuccess();
}
}
});
// onSignupFailed();
progressDialog.dismiss();
}
}, 3000);