@Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putLongArray(OUTLINE_NODES, listView.getState());
   outState.putInt(OUTLINE_CHECKED_POS, listView.getCheckedItemPosition());
   outState.putInt(OUTLINE_SCROLL_POS, listView.getFirstVisiblePosition());
 }
예제 #2
0
  /**
   * Request ArrayList of {@link com.github.gorbin.asne.core.persons.SocialPerson} by array of
   * userIds
   *
   * @param userID array of user ids in social network
   * @param onRequestSocialPersonsCompleteListener listener for request ArrayList of {@link
   *     com.github.gorbin.asne.core.persons.SocialPerson}
   */
  @Override
  public void requestSocialPersons(
      String[] userID,
      OnRequestSocialPersonsCompleteListener onRequestSocialPersonsCompleteListener) {
    super.requestSocialPersons(userID, onRequestSocialPersonsCompleteListener);
    ArrayList<String> users = new ArrayList<String>(Arrays.asList(userID));
    int i = 0;
    long[] usersId = new long[users.size()];
    for (String user : users) {
      if (TextUtils.isEmpty(user)) {
        users.remove(user);
        break;
      }
      try {
        usersId[i] = Long.parseLong(user);
      } catch (NumberFormatException e) {
        throw new SocialNetworkException("userID should be long number");
      }
      i++;
    }

    Bundle args = new Bundle();
    args.putLongArray(RequestSocialPersonsAsyncTask.PARAM_USER_ID, usersId);
    executeRequest(new RequestSocialPersonsAsyncTask(), args, REQUEST_GET_PERSON);
  }
예제 #3
0
 /**
  * Add extended data to the extra.
  *
  * @param name The name of the extra data, with package prefix.
  * @param value The byte array data value.
  * @return Returns the same extra object, for chaining multiple calls into a single statement.
  * @see #putExtras
  * @see #removeExtra
  * @see #getLongArrayExtra(String)
  */
 public Request putExtra(String name, long[] value) {
   if (mExtras == null) {
     mExtras = new Bundle();
   }
   mExtras.putLongArray(name, value);
   return this;
 }
  private void saveAndFinish() {
    String selectedCategories = "";

    SparseBooleanArray selectedItems = lv.getCheckedItemPositions();
    List<Integer> rCheckedItems = new Vector<Integer>();

    for (int i = 0; i < selectedItems.size(); i++) {
      if (selectedItems.get(selectedItems.keyAt(i)) == true) {
        rCheckedItems.add(selectedItems.keyAt(i));
        selectedCategories += loadTextArray.get(selectedItems.keyAt(i)).toString() + ",";
      }
    }

    long finalCheckedItems[] = new long[rCheckedItems.size()];

    for (int x = 0; x < rCheckedItems.size(); x++) {
      finalCheckedItems[x] = Long.parseLong(rCheckedItems.get(x).toString());
    }

    Bundle bundle = new Bundle();
    selectedCategories = selectedCategories.trim();
    if (selectedCategories.endsWith(",")) {
      selectedCategories = selectedCategories.substring(0, selectedCategories.length() - 1);
    }

    bundle.putString("selectedCategories", selectedCategories);
    bundle.putLongArray("checkedItems", finalCheckedItems);
    Intent mIntent = new Intent();
    mIntent.putExtras(bundle);
    setResult(RESULT_OK, mIntent);
    finish();
  }
  @Override
  public Parcelable saveState() {
    Bundle state = null;

    mItemIds = new long[getCount()];
    for (int i = 0; i < mItemIds.length; i++) {
      mItemIds[i] = getItemId(i);
    }
    if (mSavedState.size() > 0) {
      state = new Bundle();

      Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
      mSavedState.toArray(fss);
      state.putParcelableArray("states", fss);
    }
    for (int i = 0; i < mFragments.size(); i++) {
      Fragment f = mFragments.get(i);
      if (f != null) {
        if (state == null) {
          state = new Bundle();
        }
        String key = "f" + i;
        mFragmentManager.putFragment(state, key, f);
      }
    }

    if (mItemIds.length > 0) {
      if (state == null) {
        state = new Bundle();
      }
      state.putLongArray("itemids", mItemIds);
    }
    return state;
  }
예제 #6
0
 public static boolean putJSONValueInBundle(Bundle bundle, String key, Object value) {
   if (value == null) {
     bundle.remove(key);
   } else if (value instanceof Boolean) {
     bundle.putBoolean(key, ((Boolean) value).booleanValue());
   } else if (value instanceof boolean[]) {
     bundle.putBooleanArray(key, (boolean[]) value);
   } else if (value instanceof Double) {
     bundle.putDouble(key, ((Double) value).doubleValue());
   } else if (value instanceof double[]) {
     bundle.putDoubleArray(key, (double[]) value);
   } else if (value instanceof Integer) {
     bundle.putInt(key, ((Integer) value).intValue());
   } else if (value instanceof int[]) {
     bundle.putIntArray(key, (int[]) value);
   } else if (value instanceof Long) {
     bundle.putLong(key, ((Long) value).longValue());
   } else if (value instanceof long[]) {
     bundle.putLongArray(key, (long[]) value);
   } else if (value instanceof String) {
     bundle.putString(key, (String) value);
   } else if (value instanceof JSONArray) {
     bundle.putString(key, ((JSONArray) value).toString());
   } else if (value instanceof JSONObject) {
     bundle.putString(key, ((JSONObject) value).toString());
   } else {
     return false;
   }
   return true;
 }
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   long[] selectedArray = new long[mSelected.size()];
   for (int i = 0; i < mSelected.size(); i++) selectedArray[i] = mSelected.get(i);
   outState.putLongArray(BUNDLE_SELECTED_ITEMS_KEY, selectedArray);
   outState.putBoolean(BUNDLE_TOGGLED_KEY, mToggled);
 }
  @Override
  public void onSaveInstanceState(Bundle outState) {

    Set<Long> toInvite = friendListAdapter.getSelectedList();
    Long inviteLongArray[] = toInvite.toArray(new Long[toInvite.size()]);

    Set<Long> alreadyGrouped = friendListAdapter.getAlreadyInGroupList();
    Long alreadyGroupedLongArray[] = alreadyGrouped.toArray(new Long[alreadyGrouped.size()]);

    outState.putParcelableArrayList(
        FRIEND_LIST_MODELS, new ArrayList<Parcelable>(friendListAdapter.getItems()));
    outState.putLongArray(FRIEND_LIST_STATES, JavaUtil.toPrimitive(inviteLongArray));
    outState.putLongArray(
        FRIEND_LIST_ALREADY_IN_GROUP, JavaUtil.toPrimitive(alreadyGroupedLongArray));

    super.onSaveInstanceState(outState);
  }
 private static void putLongArray(String key, Bundle bundle) {
   int length = random.nextInt(50);
   long[] array = new long[length];
   for (int i = 0; i < length; i++) {
     array[i] = random.nextLong();
   }
   bundle.putLongArray(key, array);
 }
 private void loadArticle(long id, int position, String title) {
   Bundle args = new Bundle();
   args.putLong(DatabaseHelper.KEY_ID, id);
   args.putString(DatabaseHelper.KEY_TITLE, title);
   args.putInt(POSITION, position);
   args.putLongArray(IDS_ARRAY, getPosIdArray());
   mListener.loadArticle(args);
 }
예제 #11
0
 private void updateCacheStatus(int type, int info, long[] segments) {
   if (mEventHandler != null) {
     Message m = mEventHandler.obtainMessage(MEDIA_CACHING_UPDATE);
     Bundle b = m.getData();
     b.putInt(MEDIA_CACHING_TYPE, type);
     b.putInt(MEDIA_CACHING_INFO, info);
     b.putLongArray(MEDIA_CACHING_SEGMENTS, segments);
     mEventHandler.sendMessage(m);
   }
 }
예제 #12
0
  public void nmsSaveChatHistory(long threadId[]) {
    Bundle param = new Bundle();
    param.putLongArray(FUNC_ID_nmsSaveChatHistory + 1, threadId);

    try {
      mApiProviders.call(API_CONTENT_URI, FUNC_ID_nmsSaveChatHistory, null, param);
    } catch (Exception e) {
      NmsLog.nmsPrintStackTrace(e);
    }
  }
예제 #13
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    outState.putParcelable(STATE_BASE_URI, mBaseUri);
    outState.putLongArray(STATE_ENTRIES_IDS, mEntriesIds);
    outState.putLong(STATE_INITIAL_ENTRY_ID, mInitialEntryId);
    outState.putInt(STATE_CURRENT_PAGER_POS, mCurrentPagerPos);
    outState.putFloat(STATE_SCROLL_PERCENTAGE, mEntryPagerAdapter.getScrollPercentage());

    super.onSaveInstanceState(outState);
  }
예제 #14
0
  public void nmsDeleteIpMsg(final long[] ids, boolean delImportant, boolean isDelMsgInSmsDb) {
    if (ids == null || ids.length <= 0) {
      NmsLog.error(HissageTag.api, "nmsDeleteIpMsg param error.");
      return;
    }
    Bundle param = new Bundle();
    param.putLongArray(FUNC_ID_nmsDeleteIpMsg + 1, ids);
    param.putBoolean(FUNC_ID_nmsDeleteIpMsg + 2, delImportant);
    param.putBoolean(FUNC_ID_nmsDeleteIpMsg + 3, isDelMsgInSmsDb);

    mApiProviders.call(API_CONTENT_URI, FUNC_ID_nmsDeleteIpMsg, null, param);
  };
예제 #15
0
  @Override
  protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(ALERT_MSG, mAlertMsg);
    outState.putBoolean(ALERT_SHOWING, mAlertShowing);
    outState.putString(AUTH_URI, mUrl);

    long[] toSend = new long[mInstancesToSend.length];
    for (int i = 0; i < mInstancesToSend.length; ++i) {
      toSend[i] = mInstancesToSend[i];
    }
    outState.putLongArray(TO_SEND, toSend);
  }
  public static BackupCodeFragment newInstance(
      long[] masterKeyIds, boolean exportSecret, boolean executeBackupOperation) {
    BackupCodeFragment frag = new BackupCodeFragment();

    Bundle args = new Bundle();
    args.putString(ARG_BACKUP_CODE, generateRandomBackupCode());
    args.putLongArray(ARG_MASTER_KEY_IDS, masterKeyIds);
    args.putBoolean(ARG_EXPORT_SECRET, exportSecret);
    args.putBoolean(ARG_EXECUTE_BACKUP_OPERATION, executeBackupOperation);
    frag.setArguments(args);

    return frag;
  }
  private Bundle formatStepCount(DataReadResult dataReadResult) {
    Bundle bundle = new Bundle();

    // Step Count
    List<DataPoint> dataPointList =
        dataReadResult.getDataSet(DataType.TYPE_STEP_COUNT_DELTA).getDataPoints();
    int[] steps = new int[dataPointList.size()];
    long[] startTime = new long[dataPointList.size()];
    long[] endTime = new long[dataPointList.size()];
    int idx = 0;
    for (DataPoint dp : dataPointList) {
      steps[idx] = dp.getValue(Field.FIELD_STEPS).asInt();
      startTime[idx] = dp.getStartTime(TimeUnit.MILLISECONDS);
      endTime[idx] = dp.getEndTime(TimeUnit.MILLISECONDS);
      ++idx;
    }
    bundle.putIntArray("STEPS", steps);
    bundle.putLongArray("START_TIME", startTime);
    bundle.putLongArray("END_TIME", endTime);
    Log.d(TAG, String.format("Step data points: %d", idx));

    return bundle;
  }
  private Bundle formatDistance(DataReadResult dataReadResult) {
    Bundle bundle = new Bundle();

    // Distance
    List<DataPoint> dataPointList =
        dataReadResult.getDataSet(DataType.TYPE_DISTANCE_DELTA).getDataPoints();
    float[] distance = new float[dataPointList.size()];
    long[] startTime = new long[dataPointList.size()];
    long[] endTime = new long[dataPointList.size()];
    int idx = 0;
    for (DataPoint dp : dataPointList) {
      distance[idx] = dp.getValue(Field.FIELD_DISTANCE).asFloat();
      startTime[idx] = dp.getStartTime(TimeUnit.MILLISECONDS);
      endTime[idx] = dp.getEndTime(TimeUnit.MILLISECONDS);
      ++idx;
    }
    bundle.putFloatArray("DISTANCE", distance);
    bundle.putLongArray("START_TIME", startTime);
    bundle.putLongArray("END_TIME", endTime);
    Log.d(TAG, String.format("Distance data points: %d", idx));

    return bundle;
  }
  private Bundle formatCalories(DataReadResult dataReadResult) {
    Bundle bundle = new Bundle();

    // Calorie expenditure
    List<DataPoint> dataPointList =
        dataReadResult.getDataSet(DataType.TYPE_CALORIES_EXPENDED).getDataPoints();
    float[] calories = new float[dataPointList.size()];
    long[] startTime = new long[dataPointList.size()];
    long[] endTime = new long[dataPointList.size()];
    int idx = 0;
    for (DataPoint dp : dataPointList) {
      calories[idx] = dp.getValue(Field.FIELD_CALORIES).asFloat();
      startTime[idx] = dp.getStartTime(TimeUnit.MILLISECONDS);
      endTime[idx] = dp.getEndTime(TimeUnit.MILLISECONDS);
      ++idx;
    }
    bundle.putFloatArray("CALORIES", calories);
    bundle.putLongArray("START_TIME", startTime);
    bundle.putLongArray("END_TIME", endTime);
    Log.d(TAG, String.format("Calorie data points: %d", idx));

    return bundle;
  }
예제 #20
0
  public boolean nmsDeleteMsgFromImportantList(long[] msgIds) {
    if (msgIds == null || msgIds.length <= 0) {
      NmsLog.error(HissageTag.api, "nmsDeleteMsgFromImportantList param error.");
      return false;
    }
    Bundle param = new Bundle();
    param.putLongArray(FUNC_ID_nmsDeleteMsgFromImportantList + 1, msgIds);

    Bundle back =
        mApiProviders.call(API_CONTENT_URI, FUNC_ID_nmsDeleteMsgFromImportantList, null, param);
    if (back != null) {
      return back.getBoolean(FUNC_ID_nmsDeleteMsgFromImportantList);
    } else {
      NmsLog.error(HissageTag.api, "failed to delete msg from important list, return false");
      return false;
    }
  }
예제 #21
0
파일: Path.java 프로젝트: hetykai/android-3
 public Bundle store() {
   Bundle bundle = new Bundle();
   int n = items.size();
   int x[] = new int[n];
   int y[] = new int[n];
   long d[] = new long[n];
   n = 0;
   for (Item item : items) {
     x[n] = item.x;
     y[n] = item.y;
     d[n] = item.duration;
     ++n;
   }
   bundle.putIntArray("x", x);
   bundle.putIntArray("y", y);
   bundle.putLongArray("d", d);
   bundle.putLong("cost", cost);
   return bundle;
 }
  private Bundle formatActivity(DataReadResult dataReadResult) {
    Bundle bundle = new Bundle();

    // Activity Recognition
    List<DataPoint> dataPointList =
        dataReadResult.getDataSet(DataType.TYPE_ACTIVITY_SAMPLE).getDataPoints();
    int[] activity = new int[dataPointList.size()];
    long[] endTime = new long[dataPointList.size()];
    float[] confidence = new float[dataPointList.size()];
    int idx = 0;
    for (DataPoint dp : dataPointList) {
      activity[idx] = dp.getValue(Field.FIELD_ACTIVITY).asInt();
      confidence[idx] = dp.getValue(Field.FIELD_CONFIDENCE).asFloat();
      endTime[idx] = dp.getEndTime(TimeUnit.MILLISECONDS);
      ++idx;
    }
    bundle.putIntArray("ACTIVITY", activity);
    bundle.putFloatArray("CONFIDENCE", confidence);
    bundle.putLongArray("TIMESTAMP", endTime);
    Log.d(TAG, String.format("Activity data points: %d", idx));

    return bundle;
  }
예제 #23
0
 /**
  * save the tab state: current position position sorted array of tab ids for each tab id, save the
  * tab state
  *
  * @param outState
  * @param saveImages
  */
 void saveState(Bundle outState) {
   final int numTabs = getTabCount();
   if (numTabs == 0) {
     return;
   }
   long[] ids = new long[numTabs];
   int i = 0;
   for (Tab tab : mTabs) {
     Bundle tabState = tab.saveState();
     if (tabState != null) {
       ids[i++] = tab.getId();
       String key = Long.toString(tab.getId());
       if (outState.containsKey(key)) {
         // Dump the tab state for debugging purposes
         for (Tab dt : mTabs) {
           Log.e(LOGTAG, dt.toString());
         }
         throw new IllegalStateException("Error saving state, duplicate tab ids!");
       }
       outState.putBundle(key, tabState);
     } else {
       ids[i++] = -1;
       // Since we won't be restoring the thumbnail, delete it
       tab.deleteThumbnail();
     }
   }
   if (!outState.isEmpty()) {
     outState.putLongArray(POSITIONS, ids);
     Tab current = getCurrentTab();
     long cid = -1;
     if (current != null) {
       cid = current.getId();
     }
     outState.putLong(CURRENT, cid);
   }
 }
예제 #24
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putBoolean("isSortedBySize", mIsSortedBySize);
   outState.putLongArray("selection", getSelectionAsArray());
 }
  // function definition for updateOverview
  public void updateOverview(String userId[], float diff[], int transID) {

    int l = selectedIds.length; // last index of the arrays
    int f = 0, i = 0; // first index of the array
    long[] overviewIds = new long[selectedIds.length];
    String user1, user2;
    float amount;

    // loop the diff array till first index <= last index

    while (f < l) {

      user1 = userId[f];
      user2 = userId[l];

      // 3 conditions to be taken care of while comparing the difference values
      if (diff[f] > java.lang.Math.abs(diff[l])) {

        diff[f] = diff[f] - java.lang.Math.abs(diff[l]);
        amount = java.lang.Math.abs(diff[l]);
        diff[l] = 0;
        l--;
        if (diff[f] == 0) f++;
      } else if (diff[f] < java.lang.Math.abs(diff[l])) {

        diff[l] = java.lang.Math.abs(diff[l]) - diff[f];
        amount = diff[f];
        diff[f] = 0;
        f++;
        if (diff[l] == 0) l--;
      } else {

        amount = diff[f];
        l--;
        f++;
      }

      int id1 = Integer.valueOf(user1);
      int id2 = Integer.valueOf(user2);
      String temp;

      if (id1 > id2) {
        temp = user1;
        user1 = user2;
        user2 = temp;
        amount = -(amount);
      }

      // Adding the data to the info table

      mInfoDbAdapter.createInfo(transID, user1, user2, amount);

      Log.v(
          TAG,
          "Value going in overview update function user1:"
              + user1
              + "user2:"
              + user2
              + "amount:"
              + amount);

      // updating the overview table

      overviewIds[i] = overviewHelper.updateAmount(user1, user2, amount);
      Log.v(TAG, "id returned from update:" + overviewIds[i]);
      i++;
    }

    overviewBundle.putLongArray("overviewIds", overviewIds);
    overviewBundle.putStringArray("selectedIds", selectedIds);
    overviewBundle.putInt("idLength", i);
  }
예제 #26
0
  /** Export keys */
  public void exportKeys(long[] masterKeyIds, boolean exportSecret) {
    Log.d(Constants.TAG, "exportKeys started");

    // Send all information needed to service to export key in other thread
    final Intent intent = new Intent(mActivity, KeychainIntentService.class);

    intent.setAction(KeychainIntentService.ACTION_EXPORT_KEYRING);

    // fill values for this action
    Bundle data = new Bundle();

    data.putString(KeychainIntentService.EXPORT_FILENAME, mExportFilename);
    data.putBoolean(KeychainIntentService.EXPORT_SECRET, exportSecret);

    if (masterKeyIds == null) {
      data.putBoolean(KeychainIntentService.EXPORT_ALL, true);
    } else {
      data.putLongArray(KeychainIntentService.EXPORT_KEY_RING_MASTER_KEY_ID, masterKeyIds);
    }

    intent.putExtra(KeychainIntentService.EXTRA_DATA, data);

    // Message is received after exporting is done in KeychainIntentService
    KeychainIntentServiceHandler exportHandler =
        new KeychainIntentServiceHandler(
            mActivity,
            mActivity.getString(R.string.progress_exporting),
            ProgressDialog.STYLE_HORIZONTAL,
            true,
            new DialogInterface.OnCancelListener() {
              @Override
              public void onCancel(DialogInterface dialogInterface) {
                mActivity.stopService(intent);
              }
            }) {
          public void handleMessage(Message message) {
            // handle messages by standard KeychainIntentServiceHandler first
            super.handleMessage(message);

            if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {
              // get returned data bundle
              Bundle returnData = message.getData();

              int exported = returnData.getInt(KeychainIntentService.RESULT_EXPORT);
              String toastMessage;
              if (exported == 1) {
                toastMessage = mActivity.getString(R.string.key_exported);
              } else if (exported > 0) {
                toastMessage = mActivity.getString(R.string.keys_exported, exported);
              } else {
                toastMessage = mActivity.getString(R.string.no_keys_exported);
              }
              Toast.makeText(mActivity, toastMessage, Toast.LENGTH_SHORT).show();
            }
          }
        };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(exportHandler);
    intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);

    // show progress dialog
    exportHandler.showProgressDialog(mActivity);

    // start service with intent
    mActivity.startService(intent);
  }
  private void deserializeKey(String key, Bundle bundle) throws JSONException {
    String jsonString = cache.getString(key, "{}");
    JSONObject json = new JSONObject(jsonString);

    String valueType = json.getString(JSON_VALUE_TYPE);

    if (valueType.equals(TYPE_BOOLEAN)) {
      bundle.putBoolean(key, json.getBoolean(JSON_VALUE));
    } else if (valueType.equals(TYPE_BOOLEAN_ARRAY)) {
      JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
      boolean[] array = new boolean[jsonArray.length()];
      for (int i = 0; i < array.length; i++) {
        array[i] = jsonArray.getBoolean(i);
      }
      bundle.putBooleanArray(key, array);
    } else if (valueType.equals(TYPE_BYTE)) {
      bundle.putByte(key, (byte) json.getInt(JSON_VALUE));
    } else if (valueType.equals(TYPE_BYTE_ARRAY)) {
      JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
      byte[] array = new byte[jsonArray.length()];
      for (int i = 0; i < array.length; i++) {
        array[i] = (byte) jsonArray.getInt(i);
      }
      bundle.putByteArray(key, array);
    } else if (valueType.equals(TYPE_SHORT)) {
      bundle.putShort(key, (short) json.getInt(JSON_VALUE));
    } else if (valueType.equals(TYPE_SHORT_ARRAY)) {
      JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
      short[] array = new short[jsonArray.length()];
      for (int i = 0; i < array.length; i++) {
        array[i] = (short) jsonArray.getInt(i);
      }
      bundle.putShortArray(key, array);
    } else if (valueType.equals(TYPE_INTEGER)) {
      bundle.putInt(key, json.getInt(JSON_VALUE));
    } else if (valueType.equals(TYPE_INTEGER_ARRAY)) {
      JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
      int[] array = new int[jsonArray.length()];
      for (int i = 0; i < array.length; i++) {
        array[i] = jsonArray.getInt(i);
      }
      bundle.putIntArray(key, array);
    } else if (valueType.equals(TYPE_LONG)) {
      bundle.putLong(key, json.getLong(JSON_VALUE));
    } else if (valueType.equals(TYPE_LONG_ARRAY)) {
      JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
      long[] array = new long[jsonArray.length()];
      for (int i = 0; i < array.length; i++) {
        array[i] = jsonArray.getLong(i);
      }
      bundle.putLongArray(key, array);
    } else if (valueType.equals(TYPE_FLOAT)) {
      bundle.putFloat(key, (float) json.getDouble(JSON_VALUE));
    } else if (valueType.equals(TYPE_FLOAT_ARRAY)) {
      JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
      float[] array = new float[jsonArray.length()];
      for (int i = 0; i < array.length; i++) {
        array[i] = (float) jsonArray.getDouble(i);
      }
      bundle.putFloatArray(key, array);
    } else if (valueType.equals(TYPE_DOUBLE)) {
      bundle.putDouble(key, json.getDouble(JSON_VALUE));
    } else if (valueType.equals(TYPE_DOUBLE_ARRAY)) {
      JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
      double[] array = new double[jsonArray.length()];
      for (int i = 0; i < array.length; i++) {
        array[i] = jsonArray.getDouble(i);
      }
      bundle.putDoubleArray(key, array);
    } else if (valueType.equals(TYPE_CHAR)) {
      String charString = json.getString(JSON_VALUE);
      if (charString != null && charString.length() == 1) {
        bundle.putChar(key, charString.charAt(0));
      }
    } else if (valueType.equals(TYPE_CHAR_ARRAY)) {
      JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
      char[] array = new char[jsonArray.length()];
      for (int i = 0; i < array.length; i++) {
        String charString = jsonArray.getString(i);
        if (charString != null && charString.length() == 1) {
          array[i] = charString.charAt(0);
        }
      }
      bundle.putCharArray(key, array);
    } else if (valueType.equals(TYPE_STRING)) {
      bundle.putString(key, json.getString(JSON_VALUE));
    } else if (valueType.equals(TYPE_STRING_LIST)) {
      JSONArray jsonArray = json.getJSONArray(JSON_VALUE);
      int numStrings = jsonArray.length();
      ArrayList<String> stringList = new ArrayList<String>(numStrings);
      for (int i = 0; i < numStrings; i++) {
        Object jsonStringValue = jsonArray.get(i);
        stringList.add(i, jsonStringValue == JSONObject.NULL ? null : (String) jsonStringValue);
      }
      bundle.putStringArrayList(key, stringList);
    } else if (valueType.equals(TYPE_ENUM)) {
      try {
        String enumType = json.getString(JSON_VALUE_ENUM_TYPE);
        @SuppressWarnings({"unchecked", "rawtypes"})
        Class<? extends Enum> enumClass = (Class<? extends Enum>) Class.forName(enumType);
        @SuppressWarnings("unchecked")
        Enum<?> enumValue = Enum.valueOf(enumClass, json.getString(JSON_VALUE));
        bundle.putSerializable(key, enumValue);
      } catch (ClassNotFoundException e) {
      } catch (IllegalArgumentException e) {
      }
    }
  }