List of usage examples for org.json JSONObject optString
public String optString(String key)
From source file:com.molice.oneingdufs.androidpn.Notifier.java
public void notify(String notificationId, String apiKey, String title, String message, String uri) { Log.d(LOGTAG, "notify()..."); Log.d(LOGTAG, "notificationId=" + notificationId); Log.d(LOGTAG, "notificationApiKey=" + apiKey); Log.d(LOGTAG, "notificationTitle=" + title); Log.d(LOGTAG, "notificationMessage=" + message); Log.d(LOGTAG, "notificationUri=" + uri); if (SettingsActivity.getNotificationEnabled(context)) { // Show the toast // if (isNotificationToastEnabled()) { // Toast.makeText(context, message, Toast.LENGTH_LONG).show(); // } // Notification Notification notification = new Notification(); notification.icon = getNotificationIcon(); // notification.defaults = Notification.DEFAULT_LIGHTS; if (SettingsActivity.getNotificationSound(context)) { notification.defaults |= Notification.DEFAULT_SOUND; }/*w w w. j a v a 2s .c om*/ if (SettingsActivity.getNotificationVibrate(context)) { notification.defaults |= Notification.DEFAULT_VIBRATE; } notification.flags |= Notification.FLAG_AUTO_CANCEL; notification.when = System.currentTimeMillis(); notification.tickerText = message; // Intent intent; // if (uri != null // && uri.length() > 0 // && (uri.startsWith("http:") || uri.startsWith("https:") // || uri.startsWith("tel:") || uri.startsWith("geo:"))) { // intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); // } else { // String callbackActivityPackageName = sharedPrefs.getString( // Constants.CALLBACK_ACTIVITY_PACKAGE_NAME, ""); // String callbackActivityClassName = sharedPrefs.getString( // Constants.CALLBACK_ACTIVITY_CLASS_NAME, ""); // intent = new Intent().setClassName(callbackActivityPackageName, // callbackActivityClassName); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // } Intent intent = new Intent(context, MessageDetailActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); JSONObject data = formatMetaFromTitle(title); try { data.putOpt("id", notificationId); data.putOpt("content", message); } catch (Exception e) { Log.d("JSON", "Notifier#notify, e=" + e.toString()); } intent.putExtra("data", data.toString()); intent.putExtra("fromNotification", true); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); // intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent contentIntent = PendingIntent.getActivity(context, random.nextInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT); notification.setLatestEventInfo(context, data.optString("title"), message, contentIntent); notificationManager.notify(random.nextInt(), notification); // Intent clickIntent = new Intent( // Constants.ACTION_NOTIFICATION_CLICKED); // clickIntent.putExtra(Constants.NOTIFICATION_ID, notificationId); // clickIntent.putExtra(Constants.NOTIFICATION_API_KEY, apiKey); // clickIntent.putExtra(Constants.NOTIFICATION_TITLE, title); // clickIntent.putExtra(Constants.NOTIFICATION_MESSAGE, message); // clickIntent.putExtra(Constants.NOTIFICATION_URI, uri); // // positiveIntent.setData(Uri.parse((new StringBuilder( // // "notif://notification.adroidpn.org/")).append(apiKey).append( // // "/").append(System.currentTimeMillis()).toString())); // PendingIntent clickPendingIntent = PendingIntent.getBroadcast( // context, 0, clickIntent, 0); // // notification.setLatestEventInfo(context, title, message, // clickPendingIntent); // // Intent clearIntent = new Intent( // Constants.ACTION_NOTIFICATION_CLEARED); // clearIntent.putExtra(Constants.NOTIFICATION_ID, notificationId); // clearIntent.putExtra(Constants.NOTIFICATION_API_KEY, apiKey); // // negativeIntent.setData(Uri.parse((new StringBuilder( // // "notif://notification.adroidpn.org/")).append(apiKey).append( // // "/").append(System.currentTimeMillis()).toString())); // PendingIntent clearPendingIntent = PendingIntent.getBroadcast( // context, 0, clearIntent, 0); // notification.deleteIntent = clearPendingIntent; // // notificationManager.notify(random.nextInt(), notification); } else { Log.w(LOGTAG, "Notificaitons disabled."); } }
From source file:com.vk.sdkweb.api.model.VKApiPhoto.java
/** * Fills a Photo instance from JSONObject. *//*w w w .ja v a 2s .c om*/ public VKApiPhoto parse(JSONObject from) { album_id = from.optInt("album_id"); date = from.optLong("date"); height = from.optInt("height"); width = from.optInt("width"); owner_id = from.optInt("owner_id"); id = from.optInt("id"); text = from.optString("text"); access_key = from.optString("access_key"); photo_75 = from.optString("photo_75"); photo_130 = from.optString("photo_130"); photo_604 = from.optString("photo_604"); photo_807 = from.optString("photo_807"); photo_1280 = from.optString("photo_1280"); photo_2560 = from.optString("photo_2560"); JSONObject likes = from.optJSONObject("likes"); this.likes = ParseUtils.parseInt(likes, "count"); this.user_likes = ParseUtils.parseBoolean(likes, "user_likes"); comments = parseInt(from.optJSONObject("comments"), "count"); tags = parseInt(from.optJSONObject("tags"), "count"); can_comment = parseBoolean(from, "can_comment"); src.setOriginalDimension(width, height); JSONArray photo_sizes = from.optJSONArray("sizes"); if (photo_sizes != null) { src.fill(photo_sizes); } else { if (!TextUtils.isEmpty(photo_75)) { src.add(VKApiPhotoSize.create(photo_75, VKApiPhotoSize.S, width, height)); } if (!TextUtils.isEmpty(photo_130)) { src.add(VKApiPhotoSize.create(photo_130, VKApiPhotoSize.M, width, height)); } if (!TextUtils.isEmpty(photo_604)) { src.add(VKApiPhotoSize.create(photo_604, VKApiPhotoSize.X, width, height)); } if (!TextUtils.isEmpty(photo_807)) { src.add(VKApiPhotoSize.create(photo_807, VKApiPhotoSize.Y, width, height)); } if (!TextUtils.isEmpty(photo_1280)) { src.add(VKApiPhotoSize.create(photo_1280, VKApiPhotoSize.Z, width, height)); } if (!TextUtils.isEmpty(photo_2560)) { src.add(VKApiPhotoSize.create(photo_2560, VKApiPhotoSize.W, width, height)); } src.sort(); } return this; }
From source file:com.rapid.actions.Webservice.java
public Webservice(RapidHttpServlet rapidServlet, JSONObject jsonAction) throws Exception { // set the xml version super();//from w w w .j av a 2 s . co m // save all key/values from the json into the properties for (String key : JSONObject.getNames(jsonAction)) { // add all json properties to our properties, except for query if (!"request".equals(key) && !"root".equals(key) && !"showLoading".equals(key) && !"successActions".equals(key) && !"errorActions".equals(key)) addProperty(key, jsonAction.get(key).toString()); } // try and build the query object JSONObject jsonQuery = jsonAction.optJSONObject("request"); // check we got one if (jsonQuery != null) { // get the parameters ArrayList<Parameter> inputs = getParameters(jsonQuery.optJSONArray("inputs")); String type = jsonQuery.optString("type"); String url = jsonQuery.optString("url"); String action = jsonQuery.optString("action"); String body = jsonQuery.optString("body"); String transform = jsonQuery.optString("transform"); String root = jsonQuery.optString("root"); ArrayList<Parameter> outputs = getParameters(jsonQuery.optJSONArray("outputs")); // make the object _request = new Request(inputs, type, url, action, body, transform, root, outputs); } // look for showLoading _showLoading = jsonAction.optBoolean("showLoading"); // grab any successActions JSONArray jsonSuccessActions = jsonAction.optJSONArray("successActions"); // if we had some if (jsonSuccessActions != null) { // instantiate our success actions collection _successActions = Control.getActions(rapidServlet, jsonSuccessActions); } // grab any errorActions JSONArray jsonErrorActions = jsonAction.optJSONArray("errorActions"); // if we had some if (jsonErrorActions != null) { // instantiate our error actions collection _errorActions = Control.getActions(rapidServlet, jsonErrorActions); } }
From source file:com.rapid.actions.Webservice.java
@Override public JSONObject doAction(RapidRequest rapidRequest, JSONObject jsonAction) throws Exception { _logger.trace("Webservice action : " + jsonAction); // get the application Application application = rapidRequest.getApplication(); // get the page Page page = rapidRequest.getPage();//from w ww. j ava 2s . c om // get the webservice action call sequence int sequence = jsonAction.optInt("sequence", 1); // placeholder for the object we're about to return JSONObject jsonData = null; // only proceed if there is a request and application and page if (_request != null && application != null && page != null) { // get any json inputs JSONArray jsonInputs = jsonAction.optJSONArray("inputs"); // placeholder for the action cache ActionCache actionCache = rapidRequest.getRapidServlet().getActionCache(); // if an action cache was found if (actionCache != null) { // log that we found action cache _logger.debug("Webservice action cache found"); // attempt to fetch data from the cache jsonData = actionCache.get(application.getId(), getId(), jsonInputs.toString()); } // if there is either no cache or we got no data if (jsonData == null) { // get the body into a string String body = _request.getBody().trim(); // remove prolog if present if (body.indexOf("\"?>") > 0) body = body.substring(body.indexOf("\"?>") + 3).trim(); // check number of parameters int pCount = Strings.occurrences(body, "?"); // throw error if incorrect if (pCount != jsonInputs.length()) throw new Exception("Request has " + pCount + " parameter" + (pCount == 1 ? "" : "s") + ", " + jsonInputs.length() + " provided"); // retain the current position int pos = body.indexOf("?"); // keep track of the index of the ? int index = 0; // if there are any question marks if (pos > 0 && jsonInputs.length() > index) { // loop, but check condition at the end do { // get the input JSONObject input = jsonInputs.getJSONObject(index); // url escape the value String value = XML.escape(input.optString("value")); // replace the ? with the input value body = body.substring(0, pos) + value + body.substring(pos + 1); // look for the next question mark pos = body.indexOf("?", pos + 1); // inc the index for the next round index++; // stop looping if no more ? } while (pos > 0); } // retrieve the action String action = _request.getAction(); // create a placeholder for the request url URL url = null; // get the request url String requestURL = _request.getUrl(); // if we got one if (requestURL != null) { // if the given request url starts with http use it as is, otherwise use the soa servlet if (_request.getUrl().startsWith("http")) { // trim it requestURL = requestURL.trim(); // insert any parameters requestURL = application .insertParameters(rapidRequest.getRapidServlet().getServletContext(), requestURL); // use the url url = new URL(requestURL); } else { // get our request HttpServletRequest httpRequest = rapidRequest.getRequest(); // make a url for the soa servlet url = new URL(httpRequest.getScheme(), httpRequest.getServerName(), httpRequest.getServerPort(), httpRequest.getContextPath() + "/soa"); // check whether we have any id / version seperators String[] actionParts = action.split("/"); // add this app and version if none if (actionParts.length < 2) action = application.getId() + "/" + application.getVersion() + "/" + action; } // establish the connection HttpURLConnection connection = (HttpURLConnection) url.openConnection(); // if we are requesting from ourself if (url.getPath().startsWith(rapidRequest.getRequest().getContextPath())) { // get our session id String sessionId = rapidRequest.getRequest().getSession().getId(); // add it to the call for internal authentication connection.setRequestProperty("Cookie", "JSESSIONID=" + sessionId); } // set the content type and action header accordingly if ("SOAP".equals(_request.getType())) { connection.setRequestProperty("Content-Type", "text/xml"); connection.setRequestProperty("SOAPAction", action); } else if ("JSON".equals(_request.getType())) { connection.setRequestProperty("Content-Type", "application/json"); if (action.length() > 0) connection.setRequestProperty("Action", action); } else if ("XML".equals(_request.getType())) { connection.setRequestProperty("Content-Type", "text/xml"); if (action.length() > 0) connection.setRequestProperty("Action", action); } // if a body has been specified if (body.length() > 0) { // Triggers POST. connection.setDoOutput(true); // get the output stream from the connection into which we write the request OutputStream output = connection.getOutputStream(); // write the processed body string into the request output stream output.write(body.getBytes("UTF8")); } // check the response code int responseCode = connection.getResponseCode(); // read input stream if all ok, otherwise something meaningful should be in error stream if (responseCode == 200) { // get the input stream InputStream response = connection.getInputStream(); // prepare an soaData object SOAData soaData = null; // read the response accordingly if ("JSON".equals(_request.getType())) { SOAJSONReader jsonReader = new SOAJSONReader(); String jsonResponse = Strings.getString(response); soaData = jsonReader.read(jsonResponse); } else { SOAXMLReader xmlReader = new SOAXMLReader(_request.getRoot()); soaData = xmlReader.read(response); } SOADataWriter jsonWriter = new SOARapidWriter(soaData); String jsonString = jsonWriter.write(); jsonData = new JSONObject(jsonString); if (actionCache != null) actionCache.put(application.getId(), getId(), jsonInputs.toString(), jsonData); response.close(); } else { InputStream response = connection.getErrorStream(); String errorMessage = null; if ("SOAP".equals(_request.getType())) { String responseXML = Strings.getString(response); errorMessage = XML.getElementValue(responseXML, "faultcode"); } if (errorMessage == null) { BufferedReader rd = new BufferedReader(new InputStreamReader(response)); errorMessage = rd.readLine(); rd.close(); } // log the error _logger.error(errorMessage); // only if there is no application cache show the error, otherwise it sends an empty response if (actionCache == null) { throw new JSONException( " response code " + responseCode + " from server : " + errorMessage); } else { _logger.debug("Error not shown to user due to cache : " + errorMessage); } } connection.disconnect(); } // request url != null } // jsonData == null } // got app and page // if the jsonData is still null make an empty one if (jsonData == null) jsonData = new JSONObject(); // add the sequence jsonData.put("sequence", sequence); // return the object return jsonData; }
From source file:com.futureplatforms.kirin.internal.attic.ProxyGenerator.java
public <T> T javascriptProxyForRequest(final JSONObject obj, Class<T> baseInterface, Class<?>... otherClasses) { Class<?>[] allClasses;/* w ww . j a v a2s. com*/ if (otherClasses.length == 0) { allClasses = new Class[] { baseInterface }; } else { allClasses = new Class[otherClasses.length + 1]; allClasses[0] = baseInterface; System.arraycopy(otherClasses, 0, allClasses, 1, otherClasses.length); } InvocationHandler h = new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); Class<?> returnType = method.getReturnType(); if (obj.has(methodName)) { String id = obj.optString("__id"); if (id != null) { // so assume it's a callback if (void.class.equals(returnType)) { mKirinHelper.jsCallbackObjectMethod(id, methodName, (Object[]) args); } else { return mKirinHelper.jsSyncCallbackObjectMethod(id, returnType, methodName, (Object[]) args); } } return null; } String propertyName = findGetter(methodName); if (propertyName != null) { return handleGetter(obj, returnType, propertyName); } if ("toString".equals(methodName) && String.class.equals(returnType)) { return obj.toString(); } return null; } }; Object proxy = Proxy.newProxyInstance(baseInterface.getClassLoader(), allClasses, h); return baseInterface.cast(proxy); }
From source file:com.produban.cloudfoundry.bosh.bosh_javaclient.BoshClientImpl.java
/** * This method launches a complex query, which requires a single BOSH task * to be launched and completed. This method performs the query, gathers the * task number, waits for its completion and returns its results. * * @param path path to query/*from w w w . j a v a 2 s. c o m*/ * @return the results of the launched tasks * @throws BoshClientException if there are problems */ public String doComplexQuerySingleTask(String path) throws BoshClientException { BoshResponse initialRequestResults = doSimpleRequest(path); if (initialRequestResults.getStatusCode() != 302 || !initialRequestResults.getHeaders().containsKey("Location") || initialRequestResults.getHeaders().get("Location").isEmpty()) { throw new BoshClientException( "Unexpected response from BOSH director. Please check whether the path leads to a single task creation. Response results are: " + initialRequestResults); } String locationValue = initialRequestResults.getHeaders().get("Location").get(0); Pattern taskNumberPattern = Pattern.compile(REGEX_TASK_LOCATION); Matcher taskNumberMatcher = taskNumberPattern.matcher(locationValue); boolean matches = taskNumberMatcher.matches(); if (!matches) { throw new BoshClientException( "Location header containing task number has an unexpected format: " + locationValue); } String taskNumberStr = taskNumberMatcher.group("taskNumber"); boolean completed = false; while (!completed) { try { HttpsURLConnection taskRequestHttpsURLConnection = setupHttpsUrlConnection( "/tasks/" + taskNumberStr); int taskRequestStatusCode = taskRequestHttpsURLConnection.getResponseCode(); if (taskRequestStatusCode >= 300) { throw new BoshClientException( "Received code " + taskRequestStatusCode + " while requesting task status."); } String taskRequestResponse = getResponseBody(taskRequestHttpsURLConnection); try { JSONObject taskJson = new JSONObject(taskRequestResponse); String state = taskJson.optString("state"); if (state.equals("done")) { completed = true; break; } } catch (JSONException e) { } } catch (IOException e) { throw new BoshClientException("Error while requesting task state or results", e); } try { Thread.sleep(500); } catch (InterruptedException e) { throw new BoshClientException("Interrupted while sleeping", e); } } try { HttpsURLConnection taskResultHttpsURLConnection = setupHttpsUrlConnection( "/tasks/" + taskNumberStr + "/output?type=result"); int responseCode = taskResultHttpsURLConnection.getResponseCode(); if (responseCode >= 300) { throw new BoshClientException( "Unexpected " + responseCode + " response code while getting task results"); } String result = getResponseBody(taskResultHttpsURLConnection); return result; } catch (IOException e) { throw new BoshClientException("Error while getting results", e); } }
From source file:com.basetechnology.s0.agentserver.field.MultiChoiceField.java
public static Field fromJson(SymbolTable symbolTable, JSONObject fieldJson) { String type = fieldJson.optString("type"); if (type == null || !type.equals("multi_choice_field")) return null; String name = fieldJson.has("name") ? fieldJson.optString("name") : null; String label = fieldJson.has("label") ? fieldJson.optString("label") : null; String description = fieldJson.has("description") ? fieldJson.optString("description") : null; String defaultValue = fieldJson.has("default_value") ? fieldJson.optString("default_value") : null; List<String> choices = new ArrayList<String>(); if (fieldJson.has("choices")) { JSONArray choicesJson = fieldJson.optJSONArray("choices"); int n = choicesJson.length(); for (int i = 0; i < n; i++) choices.add(choicesJson.optString(i)); }//from w w w.jav a 2 s . c om int nominalWidth = fieldJson.has("nominal_width") ? fieldJson.optInt("nominal_width") : 0; String compute = fieldJson.has("compute") ? fieldJson.optString("compute") : null; return new MultiChoiceField(symbolTable, name, label, description, defaultValue, choices, nominalWidth, compute); }
From source file:com.example.protocol.STATUSES.java
public void fromJson(JSONObject jsonObject) throws JSONException { if (null == jsonObject) { return;/* w w w .jav a 2 s .c om*/ } JSONArray subItemArray; this.comments_count = jsonObject.optInt("comments_count"); this.text = jsonObject.optString("text"); this.in_reply_to_screen_name = jsonObject.optString("in_reply_to_screen_name"); this.truncated = jsonObject.optBoolean("truncated"); this.bmiddle_pic = jsonObject.optString("bmiddle_pic"); this.thumbnail_pic = jsonObject.optString("thumbnail_pic"); this.source = jsonObject.optString("source"); this.favorited = jsonObject.optBoolean("favorited"); this.original_pic = jsonObject.optString("original_pic"); this.in_reply_to_status_id = jsonObject.optString("in_reply_to_status_id"); this.reposts_count = jsonObject.optInt("reposts_count"); this.created_at = jsonObject.optString("created_at"); this.in_reply_to_user_id = jsonObject.optString("in_reply_to_user_id"); subItemArray = jsonObject.optJSONArray("annotations"); if (null != subItemArray) { for (int i = 0; i < subItemArray.length(); i++) { String subItemObject = subItemArray.optString(i); String subItem = subItemObject; this.annotations.add(subItem); } } this.mid = jsonObject.optString("mid"); USER user = new USER(); user.fromJson(jsonObject.optJSONObject("user")); this.user = user; return; }
From source file:edu.stanford.junction.api.activity.ActivityScript.java
public ActivityScript(JSONObject json) { mJSON = json;/*from www. j a v a 2s . c o m*/ // TODO: Deprecate. These should not be in the activityDescription. // preferred if (json.has("switchboard")) { host = json.optString("switchboard"); } // deprecated else if (json.has("host")) { host = json.optString("host"); } // TODO: rename this field if (json.has(("ad"))) { activityID = json.optString("ad"); } if (json.has("friendlyName")) { friendlyName = json.optString("friendlyName"); } if (json.has("sessionID")) { sessionID = json.optString("sessionID"); } //////////////////////////////////////////// roleSpecs = json.optJSONObject("roles"); }
From source file:com.abeo.tia.noordin.ProcessCaseLoanPrincipal.java
private void setallvalues(String arg2) { JSONArray jObj = null;/* www .jav a 2 s . c o m*/ try { jObj = new JSONArray(arg2.toString()); for (int i = 0; i < jObj.length(); i++) { JSONObject jsonobject = jObj.getJSONObject(i); file_open_date.setText(jsonobject.getString("FileOpenDate")); case_file_no.setText(jsonobject.getString("CaseFileNo")); case_type.setText(jsonobject.getString("CaseType")); Scase_status = jsonobject.getString("CaseStatus"); JSONObject obj1 = jsonobject.getJSONObject("LoanPrinciple"); req_for_redemption.getText().toString(); req_for_redemption.setText(obj1.getString("ReqRedStatement")); red_state_date.setText(obj1.getString("RedStmtDate")); red_payment_date.setText(obj1.getString("RedPayDate")); loan_case_no.setText(obj1.getString("LoanCaseNo")); project.setText(obj1.getString("Project")); master_bankname = obj1.getString("MasterBankName"); branch_name.setText(obj1.getString("BranchName")); addr.setText(obj1.getString("Address")); pa_name.setText(obj1.getString("PAName")); bank_ref.setText(obj1.getString("BankRef")); bank_instr_date.setText(obj1.getString("BankInsDate")); letter_offer_date.setText(obj1.getString("LOFDate")); bank_solicitor.setText(obj1.getString("BankSolicitor")); solicitor_loc.setText(obj1.getString("SoliLoc")); solicitor_ref.setText(obj1.getString("SoliRef")); type_facility.setText(obj1.getString("TypeofFacility")); facility_amt.setText(obj1.getString("FacilityAmt")); repayment.setText(obj1.getString("Repaymt")); interest_rate.setText(obj1.getString("IntrstRate")); monthly_installment.setText(obj1.optString("MonthlyInstmt")); term_loanamt.setText(obj1.getString("TermLoanAmt")); interest.setText(obj1.optString("Interest")); od_loan.setText(obj1.getString("ODLoan")); mrta.setText(obj1.getString("MRTA")); bank_guarantee.setText(obj1.optString("BankGuarantee")); letter_credit.setText(obj1.getString("LetterofCredit")); trust_receipt.setText(obj1.optString("TrustReceipt")); others.setText(obj1.getString("Others")); LoanDet1.setText(obj1.getString("LoanDet1")); LoanDet2.setText(obj1.getString("LoanDet2")); LoanDet3.setText(obj1.getString("LoanDet3")); LoanDet4.setText(obj1.getString("LoanDet4")); LoanDet5.setText(obj1.getString("LoanDet5")); Skiv = jsonobject.getString("KIV"); SLoanTypeOfLoans = obj1.getString("TypeofLoan"); if (obj1.getString("RepByFirm").toString().equals("Y")) { rep_firm.setChecked(true); } else { rep_firm.setChecked(false); } } System.out.println(jObj); dropdownstatus(); dropdownKIV(); dropdownLTY(); dropdownBankDeveloperSolicitor(); } catch (JSONException e) { e.printStackTrace(); } }