SliderLayout总是拍错照片

时间:2018-07-10 06:13:48

标签: android slider

例如

当您不选择“ smp4”时,图片必须不是smp4,但就我而言,我的SliderLayout总是选择全部或错误图片

the wrong picture

这是

 private void getGambar() {
    String url = "https://arizalway.000webhostapp.com/api/getgambar.php?StudioMusik=" + id;
    Log.i(TAG, url);
    JsonArrayRequest request = new JsonArrayRequest
            (Request.Method.GET, url, new Response.Listener<JSONArray>() {
                @Override
                public void onResponse(JSONArray response) {
                    int numData = response.length();
                    if (numData == 0) mDemoSlider.setVisibility(View.GONE);
                    else {
                        JSONObject slider_studio;
                        Log.i(TAG, "On Response get gambar");
                        String[] gambar_sekolah = new String[numData], nama_sekolah = new String[numData];
                        HashMap<String, String> url_maps = new HashMap<String, String>();
                        for (int i = 0; i < numData; i++) {
                            try {
                                slider_studio = response.getJSONObject(i);
                                gambar_sekolah[i] = slider_studio.getString("gambar");
                                nama_sekolah[i] = slider_studio.getString("nama");
                                url_maps.put(nama_sekolah[i], "https://arizalway.000webhostapp.com/api/slider_studio/" + gambar_sekolah[i]);
                            } catch (JSONException je) {
                                Toast.makeText(DetailSekolah.this, "JSON ERROR", Toast.LENGTH_SHORT).show();
                            }
                        }
                        for (String name : url_maps.keySet()) {
                            TextSliderView textSliderView = new TextSliderView(DetailSekolah.this);
                            textSliderView.description(name).image(url_maps.get(name)).setScaleType(BaseSliderView.ScaleType.Fit);
                            textSliderView.bundle(new Bundle());
                            textSliderView.getBundle().putString("extra", name);
                            mDemoSlider.addSlider(textSliderView);
                            mDemoSlider.setPresetTransformer(SliderLayout.Transformer.ZoomOut);
                            mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
                            mDemoSlider.setCustomAnimation(new DescriptionAnimation());
                            mDemoSlider.setDuration(30000);

                        }
                    }
                }
            },
                    new Response.ErrorListener() {
                        @Override
                        public void onErrorResponse(VolleyError error) {
                        }
                    });
    Volley.newRequestQueue(this).add(request);
}

我的朋友说(并且也在网络上搜索)托管中的名称图片和数据库中的图片名称必须相同,但是我已经做到了,但是没有运气

file in host

database picture

id from database studio

谢谢,抱歉我的英语不好

0 个答案:

没有答案