private void getNo() { pDialog = new ProgressDialog(this); showDialog(); pDialog.setContentView(R.layout.progress_dialog); pDialog.getWindow().setBackgroundDrawableResource( android.R.color.transparent ); StringRequest stringRequest1 = new StringRequest(Request.Method.GET, "http://example.co.id/rest_server/api/nomor_pengajuan/index_full_day", new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject obj = new JSONObject(response); JSONArray movieArray = obj.getJSONArray("data"); for (int i = 0; i < movieArray.length(); i++) { JSONObject movieObject = movieArray.getJSONObject(i); getNo_pengajuan_full nomor = new getNo_pengajuan_full( movieObject.getInt("no_pengajuan_full_day")); no_pengajuan.add(nomor); getNo_pengajuan_full item = no_pengajuan.get(no_pengajuan.size() - 1); nopengajuan.setText(String.valueOf(item.getNo_pengajuan_full() + 1)); hideDialog(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(getApplicationContext(), "Maaf, ada kesalahan", Toast.LENGTH_SHORT).show(); } }); RequestQueue requestQueue1 = Volley.newRequestQueue(this); requestQueue1.add(stringRequest1); }
@Override public void onResponse(String response) { try { JSONObject obj = new JSONObject(response); JSONObject movieObject = obj.getJSONObject(response); getNo_pengajuan_full nomor = new getNo_pengajuan_full( movieObject.getInt("no_pengajuan_full_day")); no_pengajuan.add(nomor); getNo_pengajuan_full item = no_pengajuan.get(no_pengajuan.size() - 1); nopengajuan.setText(String.valueOf(item.getNo_pengajuan_full() + 1)); hideDialog();
getInt()
onResponse()
JSONArray array = obj.getJSONArray(""); JSONObject data = array.getJSONObject(last_index);
obj
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)