Sorry for my bad English,I have list of dates coming from json
{
"data": [
{
"lead_id": "1763",
"name": "Gaurav Kumar",
"date": "16-02-2020",
"time": "10:00 To 11:00 AM",
},
{
"lead_id": "1759",
"name": "Test",
"date": "04-02-2020",
"time": "10:00 To 11:00 AM",
},
{
"lead_id": "1751",
"name": "kavita sharma",
"date": "08-02-2020",
"time": "10:00 To 11:00 AM",
},
{
"lead_id": "1751",
"name": "kavita sharma",
"date": "09-02-2020",
"time": "10:00 To 11:00 AM",
}
]
}
Below code helps me to find the current date
Calendar calendar = Calendar.getInstance();
Date today = calendar.getTime();
@SuppressLint("SimpleDateFormat")
DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
todayAsString = dateFormat.format(today);
System.out.println(todayAsString);
But i want to know how can i check if the list of date is of the same month.
//Here is the code the i used to check the current date but i want to check if the all dates is of the same months.PLease let me know how could i do this
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://delhidailyservice.com/api/")
.addConverterFactory(GsonConverterFactory.create())
.build();
APIService request = retrofit.create(APIService.class);
Call<LeadData> call = request.leadData(prefConfig.readLoginId());
call.enqueue(new Callback<LeadData>() {
@Override
public void onResponse(Call<LeadData> call, Response<LeadData> response) {
/* new Handler().postDelayed(new Runnable() {
public void run() {
// if (isAdded()) {
pDialog.dismiss();
// }
}
}, 5000);*/
pDialog.dismiss();
LeadData allEvent = response.body();
allEventData = (List<Leads>) allEvent.getData();
// Log.d("Error", ""+allEventData.size());
allEventDatanew.clear();
for (int i = 0; i < allEventData.size(); i++) {
if (todayAsString.equalsIgnoreCase(allEventData.get(i).getDate())) {
Leads allevent = new Leads();
String service = allEventData.get(i).getService();
String date = allEventData.get(i).getDate();
String name = allEventData.get(i).getName();
String time = allEventData.get(i).getTime();
String city = allEventData.get(i).getCity();
String status = allEventData.get(i).getStatus();
String credit = allEventData.get(i).getCredit();
String address = allEventData.get(i).getAddress();
String id = allEventData.get(i).getLeadId();
try {
//String details = allEventData.get(i).getDetail();
//abcd = Html.fromHtml(details).toString();
// tv_detail.setText(abcd);
} catch (Exception e) {
e.printStackTrace();
}
allevent.setService(service);
allevent.setDate(date);
allevent.setName(name);
allevent.setTime(time);
allevent.setCity(address + " , " + city);
allevent.setStatus(status);
allevent.setCredit(credit);
allevent.setLeadId(id);
allEventDatanew.add(allevent);
}
}
// Log.d("Error1", ""+allEventDatanew.size());
individualDataAdapter = new LeadAdapter(allEventDatanew, getContext());
recyclerViewIndividualEvent.setAdapter(individualDataAdapter);
individualDataAdapter.notifyDataSetChanged();