samedi 21 juillet 2018

How to save multiple checkbox listview array with floating save button into database mysql

Sample image click here

I have mobile attendance project, how to insert data new data student n date from multiple checkbox student to database mysql.

// server response methods
    @Override
    public void requestFinished(String response, int requestTag) {
        if (progressDialog.isShowing())
            progressDialog.dismiss();
        boolean jsonError = false;
        try {
            if (requestTag == GET_CLASS_LIST_REQUEST) {
                JSONArray jsonArray = new JSONArray(response);
                classList = new ArrayList<>();
                for (int i=0;i<jsonArray.length();i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    String classId = jsonObject.optString("section_id");
                    String className = jsonObject.optString("name");
                    classNames.add(className);
                    classList.add(new JurusanInfo(classId, className));
                }
                classListAdapter.notifyDataSetChanged();
            }
            else if (requestTag == GET_ATTENDANCE_REQUEST) {
                attendanceList.clear();
                attendanceList.add(new DaftarHadirInfo("Roll", "Nama", "Status"));
                JSONArray jsonArray = new JSONArray(response);
                for (int i=0;i<jsonArray.length();i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    String roll = jsonObject.optString("roll");
                    String name = jsonObject.optString("name");
                    String status = jsonObject.optString("status");
                    attendanceList.add(new DaftarHadirInfo(roll, name, status));
                }
                daftarHadirAdapter1.notifyDataSetChanged();
            }
        }
        catch (JSONException e) {
            jsonError = true;
        }
        if (jsonError) {
            showAlert("Halaman Absensi Error");
        }
    }

enter code here




Aucun commentaire:

Enregistrer un commentaire