узел JSON в Android Studio0 - PullRequest
       9

узел JSON в Android Studio0

0 голосов
/ 06 сентября 2018

Я новичок в Android. Я пишу код запроса в nodejs, который получает таблицу базы данных. Я пытаюсь это с postman, и это было правильно, и возвращаю JSON. Но в Android studio он возвращается пустым на мониторе Android. ниже мой код Android. где моя проблема? Я использовал IP своей системы для локального адреса, но не

public class ActGroups extends AppCompatActivity {


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_groups);


        get_groups();
    }


    void get_groups(){


        String url=mylib.ClsVars.get_url(1);

        final StringRequest stringRequest=new StringRequest(Request.Method.POST, url,

                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        Log.i("resp", response);


                        ///  Log.i("fragment Home", "-----------------------------------------response  not    ok");
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {


                           Log.i("err",error.getMessage());
                    }
                }

        ){

            @Override
            protected Map<String,String>getParams()throws AuthFailureError {


                Map<String, String> map = new Hashtable<String, String>();
                map.put("name", Base64.encodeToString("".getBytes(), Base64.DEFAULT));
                return map;
            }

        };

        RequestQueue requestQueue = Volley.newRequestQueue(ActGroups.this);
        requestQueue.add(stringRequest);
    }


}

это сообщение man json:

[
    {
        "id": 1,
        "u_name": "u",
        "u_family": "uu"
    },


    {
         "id": 3,
         "u_name": "a",
         "u_family": "aa"
    },

    {
        "id": 6,
        "u_name": "b",
        "u_family": "bb"
    }
]

и ниже - вывод logcat:

09-06 16:11:21.716 3821-3821/? I/art: Late-enabling -Xcheck:jni
09-06 16:11:21.738 3821-3827/? E/art: Failed sending reply to debugger: Broken pipe
09-06 16:11:21.739 3821-3827/? I/art: Debugger is no longer active
    Starting a blocking GC Instrumentation
09-06 16:11:21.850 3821-3821/? W/System: ClassLoader referenced unknown path: /data/app/com.example.hosseinry.tour-1/lib/x86
09-06 16:11:21.865 3821-3821/? I/InstantRun: starting instant run server: is main process
09-06 16:11:21.931 3821-3821/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-06 16:11:21.947 3821-3835/? D/libEGL: loaded /system/lib/egl/libEGL_adreno.so
09-06 16:11:21.974 3821-3835/? D/libEGL: loaded /system/lib/egl/libGLESv1_CM_adreno.so
09-06 16:11:21.985 3821-3835/? D/libEGL: loaded /system/lib/egl/libGLESv2_adreno.so
09-06 16:11:22.063 3821-3837/? I/OpenGLRenderer: Initialized EGL, version 1.4
09-06 16:11:22.063 3821-3837/? D/OpenGLRenderer: Swap behavior 1
09-06 16:11:22.106 3821-3837/? W/EGL_emulation: eglSurfaceAttrib not implemented 3093 12436
09-06 16:11:22.106 3821-3837/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb707f2c0, error=EGL_SUCCESS
09-06 16:11:22.123 3821-3821/? W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
09-06 16:12:13.209 3821-3821/com.example.hosseinry.tour I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
09-06 16:12:13.213 3821-3821/com.example.hosseinry.tour I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
09-06 16:12:13.215 3821-3821/com.example.hosseinry.tour I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
09-06 16:12:13.217 3821-3821/com.example.hosseinry.tour I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
09-06 16:12:13.319 3821-3837/com.example.hosseinry.tour W/EGL_emulation: eglSurfaceAttrib not implemented 3093 12436
09-06 16:12:13.319 3821-3837/com.example.hosseinry.tour W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb70042a0, error=EGL_SUCCESS
09-06 16:12:13.400 3821-3837/com.example.hosseinry.tour D/OpenGLRenderer: endAllActiveAnimators on 0xb149d480 (RippleDrawable) with handle 0x9d2244a0

Каково решение этой проблемы?

...