单击NextFragment中的Recycler-view Item时,打开相同的项目数据

时间:2018-12-22 07:15:53

标签: android web-services

我有一些物品的回收视图。当我单击项目(例如Item1)时,然后在根据该项目的nextFragment中,我正在使用webServices根据它显示一些特定数据。

 Retrofit retrofit = new Retrofit.Builder()
            .baseUrl("http://delitem.com/api/allevent.php/")
            .addConverterFactory(GsonConverterFactory.create())
            .build();
    APIService request = retrofit.create(APIService.class);
    Call<AllEvent> call = request.getAllEvent();
    call.enqueue(new Callback<AllEvent>() {
        @Override
        public void onResponse(Call<AllEvent> call, Response<AllEvent> response) {

            pDialog.dismiss();

            AllEvent allEvent = response.body();


            allEventData = (ArrayList<AllEventDatum>) allEvent.getDataAllEvent();

            for (int i = 0; i < allEventData.size(); i++) {

                if (strOutdoors.equalsIgnoreCase("Outdoors")) {

                    if (allEventData.get(i).getCategory().equalsIgnoreCase("Outdoors")) {
                        individualDataAdapter = new IndividualDataAdapter(allEventData);
                        recyclerViewIndividualEvent.setAdapter(individualDataAdapter);
                    }
                }
                if (strClassesWork.equalsIgnoreCase("Classes And Workshops")) {
                    if (allEventData.get(i).getCategory().equalsIgnoreCase("Classes And Workshops")) {
                        individualDataAdapter = new IndividualDataAdapter(allEventData);
                        recyclerViewIndividualEvent.setAdapter(individualDataAdapter);
                    }
                }

                if (strpartiesNightLife.equalsIgnoreCase("Parties And Nightlife")) {
                    if (allEventData.get(i).getCategory().equalsIgnoreCase("Parties And Nightlife")) {
                        individualDataAdapter = new IndividualDataAdapter(allEventData);
                        recyclerViewIndividualEvent.setAdapter(individualDataAdapter);
                    }
                }


            }


        }

        @Override
        public void onFailure(Call<AllEvent> call, Throwable t) {

            pDialog.dismiss();
            Log.d("Error", t.getMessage());
        }
    });

我需要显示相同的json对象数据并将其设置为recyclerview。

非常感谢。

0 个答案:

没有答案