Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- simpleCalendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
- @Override
- public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) {
- // display the selected date by using a toast
- int y = year;
- int m = month + 1;
- int d = dayOfMonth;
- final String date = d + "/" + m + "/" + y;
- final ProgressDialog loading = ProgressDialog.show(Daily_Attendance.this, "Processing...", "Please wait...", false, false);
- StringRequest stringRequest = new StringRequest(Request.Method.POST, url3, new Response.Listener<String>() {
- @Override
- public void onResponse(String response) {
- try {
- Log.d("rr",response);
- loading.dismiss();
- JSONArray j = new JSONArray(response);
- JSONObject jo = j.getJSONObject(0);
- String res = jo.getString("result");
- if (res.equals("true")) {
- alert.setMessage("You Were Present on " + date)
- .setPositiveButton("ok", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- }
- })
- .show();
- }
- if (res.equals("false")) {
- alert.setMessage("You were Absent on " + date)
- .setPositiveButton("ok", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- }
- })
- .show();
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- }, new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- loading.dismiss();
- Toast.makeText(Daily_Attendance.this, "Connection Error..", Toast.LENGTH_SHORT).show();
- }
- }) {
- @Override
- protected Map<String, String> getParams() throws AuthFailureError {
- Map<String, String> param = new HashMap<>();
- param.put("date", date);
- param.put("semester", semester);
- param.put("section", section);
- param.put("subject_name", subject_name);
- param.put("subject_type", subject_type);
- param.put("subject_code", subject_code);
- param.put("registration_number",user.get(sessionManagement.KEY_REGISTRATION_NUMBER));
- return param;
- }
- };
- AppController.getInstance().addToRequestQueue(stringRequest);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement