Wednesday 26 October 2022

If I click on prev,next,today calendar, I want to get prev data calendar, how is that?

image clik -> If I click on prev,next,today I want to get data with calender.I am getting many errors.How to fix this error?

prev.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            googleMap.clear();
            Date date1=new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24) * minusButtonPressed);
            SimpleDateFormat sdf=new SimpleDateFormat("dd-MMM-yyyy");
            String date=sdf.format(date1);
            drawRoute(date);
            calculateDistance(date);
            minusButtonPressed += 1;
        }
    });

    next.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            googleMap.clear();
            Date date1=new Date(System.currentTimeMillis() + (1000 * 60 * 60 * 24) * plusButtonPressed);
            SimpleDateFormat sdf=new SimpleDateFormat("dd-MMM-yyyy");
            String date=sdf.format(date1);
            drawRoute(date);
            calculateDistance(date);
            plusButtonPressed += 1;
        }
    });

rest api click path How to set restapi id if calendar prev next is clicked callbackCall = apiInterface.getRecipesByCategory(date, AppConfig.REST_API_KEY);

private void requestHomeData2() {
    this.callbackCall = RestAdapter.createAPI(sharedPref.getApiUrl()).getHome(AppConfig.REST_API_KEY);
    callbackCall = apiInterface.getRecipesByCategory(date, AppConfig.REST_API_KEY);

    this.callbackCall.enqueue(new Callback<CallbackHome>() {
        public void onResponse(Call<CallbackHome> call, Response<CallbackHome> response) {
            CallbackHome responseHome = response.body();
            if (responseHome == null || !responseHome.status.equals("ok")) {
                onFailRequest();
                return;
            }
            displayData(responseHome);
            swipeProgress(false);
            lyt_main_content.setVisibility(View.VISIBLE);
        }

        public void onFailure(Call<CallbackHome> call, Throwable th) {
            Log.e("onFailure", th.getMessage());
            if (!call.isCanceled()) {
                onFailRequest();
            }
        }
    });


from If I click on prev,next,today calendar, I want to get prev data calendar, how is that?

No comments:

Post a Comment