List of usage examples for org.json JSONArray toString
public String toString()
From source file:cz.muni.fi.japanesedictionary.entity.Translation.java
/** * Adds Translation to given bundle./*from w ww .j av a 2s . c o m*/ * * @param bundle - bundle in which translation should be saved * - in case of null empty bundle is created * @return Bundle returns bundle which contains Translation */ public Bundle createBundleFromTranslation(Bundle bundle) { if (bundle == null) { bundle = new Bundle(); } if (this.getJapaneseKeb() != null && this.getJapaneseKeb().size() > 0) { bundle.putString(SAVE_JAPANESE_KEB, (new JSONArray(this.getJapaneseKeb())).toString()); } if (this.getJapaneseReb() != null && this.getJapaneseReb().size() > 0) { bundle.putString(SAVE_JAPANESE_REB, (new JSONArray(this.getJapaneseReb())).toString()); } if (this.getDutchSense() != null && this.getDutchSense().size() > 0) { JSONArray sense = convertToJSON(this.getDutchSense()); bundle.putString(SAVE_DUTCH, sense.toString()); } if (this.getEnglishSense() != null && this.getEnglishSense().size() > 0) { JSONArray sense = convertToJSON(this.getEnglishSense()); bundle.putString(SAVE_ENGLISH, sense.toString()); } if (this.getFrenchSense() != null && this.getFrenchSense().size() > 0) { JSONArray sense = convertToJSON(this.getFrenchSense()); bundle.putString(SAVE_FRENCH, sense.toString()); } if (this.getGermanSense() != null && this.getGermanSense().size() > 0) { JSONArray sense = convertToJSON(this.getGermanSense()); bundle.putString(SAVE_GERMAN, sense.toString()); } if (this.getRussianSense() != null && this.getRussianSense().size() > 0) { JSONArray sense = convertToJSON(this.getRussianSense()); bundle.putString(SAVE_RUSSIAN, sense.toString()); } bundle.putBoolean(SAVE_PRIORITIZED, mPrioritized); bundle.putString(SAVE_RUBY, mRuby); return bundle; }
From source file:cz.muni.fi.japanesedictionary.entity.Translation.java
/** * Creates ContentValues from translations for purpose of saving in database. * /*www . j a v a 2 s . c o m*/ * @return ContentValues contains saved Translation */ public ContentValues createContentValuesFromTranslation() { ContentValues values = new ContentValues(); if (this.getJapaneseKeb() != null && this.getJapaneseKeb().size() > 0) { values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_JAPANESE_KEB, (new JSONArray(this.getJapaneseKeb())).toString()); } if (this.getJapaneseReb() != null && this.getJapaneseReb().size() > 0) { values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_JAPANESE_REB, (new JSONArray(this.getJapaneseReb())).toString()); } if (this.getDutchSense() != null && this.getDutchSense().size() > 0) { JSONArray sense = convertToJSON(this.getDutchSense()); values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_DUTCH, sense.toString()); } if (this.getEnglishSense() != null && this.getEnglishSense().size() > 0) { JSONArray sense = convertToJSON(this.getEnglishSense()); values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_ENGLISH, sense.toString()); } if (this.getFrenchSense() != null && this.getFrenchSense().size() > 0) { JSONArray sense = convertToJSON(this.getFrenchSense()); values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_FRENCH, sense.toString()); } if (this.getGermanSense() != null && this.getGermanSense().size() > 0) { JSONArray sense = convertToJSON(this.getGermanSense()); values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_GERMAN, sense.toString()); } if (this.getRussianSense() != null && this.getRussianSense().size() > 0) { JSONArray sense = convertToJSON(this.getRussianSense()); values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_RUSSIAN, sense.toString()); } values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_PRIORITIZED, mPrioritized ? 1 : 0); values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_RUBY, mRuby); values.put(GlossaryReaderContract.GlossaryEntryFavorite.COLUMN_NAME_LAST_VIEWED, (new Date()).getTime()); return values; }
From source file:com.sesamtv.cordova.chromecast.ChromeCast.java
private void onReceiverListChanged() { cordova.getActivity().runOnUiThread(new Runnable() { public void run() { Log.d(TAG, "onReceiverListChanged " + (receiverCallback != null)); if (receiverCallback != null) { JSONArray jsonRoute = getRoutes(); PluginResult result = new PluginResult(PluginResult.Status.OK, jsonRoute); result.setKeepCallback(true); Log.d(TAG, "onReceiverListChanged " + jsonRoute.toString()); receiverCallback.sendPluginResult(result); }/*from w w w . j av a 2 s . com*/ } }); }