我试图在改造中发布jsonobject

时间:2018-06-30 08:09:34

标签: java android retrofit2

您好,我尝试使用改型将json数据发布到服务器 界面

  @POST("something")
    Call<Test_Responce> testRes (@Body JSONObject paramObject);

功能

try {
            JSONObject paramObject = new JSONObject();
            paramObject.put("test_id", 5);
            paramObject.put("user_id", "null");
            paramObject.put("org_id", 2);
            paramObject.put("schedule_id", 15);
            paramObject.put("group_id", "null");

            JSONObject current_section = new JSONObject();

            paramObject.put("current_section",current_section);


            Call<Test_Responce> userCall = api_interface.testRes(paramObject);
            userCall.enqueue(new Callback<Test_Responce>() {
                @Override
                public void onResponse(Call<Test_Responce> call, Response<Test_Responce> response) {
                    if (response.isSuccessful()){
                        Toast.makeText(getApplicationContext(),"success",Toast.LENGTH_SHORT).show();
                    }else {
                        Toast.makeText(getApplicationContext(),"else",Toast.LENGTH_SHORT).show();

                    }
                }

它执行其他部分...我不知道哪里出错了

0 个答案:

没有答案