当前位置: 首页>>代码示例>>Java>>正文


Java Bundle.putParcelableArray方法代码示例

本文整理汇总了Java中android.os.Bundle.putParcelableArray方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putParcelableArray方法的具体用法?Java Bundle.putParcelableArray怎么用?Java Bundle.putParcelableArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.putParcelableArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    Value[] items = valueAdapter.getItems();
    Log.i("ListValuesFragment", "Number of items: " + items.length);
    if (items.length > 0) {
        outState.putParcelableArray(BUNDLE_KEY, items);
    }
    super.onSaveInstanceState(outState);
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:10,代码来源:ListValuesFragment.java

示例2: saveState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public Parcelable saveState() {
  Bundle state = new Bundle();
  if (mSavedState.size() > 0) {
    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 && f.isAdded()) {
      String key = "f" + i;
      mFragmentManager.putFragment(state, key, f);
    }
  }
  state.putString("mode", this.mode);
  return state;
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:19,代码来源:FragmentStatePagerAdapter.java

示例3: e

import android.os.Bundle; //导入方法依赖的package包/类
public Bundle e() {
    Bundle bundle = new Bundle();
    bundle.putString("ext_ele_name", this.a);
    bundle.putString("ext_ns", this.b);
    bundle.putString("ext_text", this.e);
    Bundle bundle2 = new Bundle();
    if (this.c != null && this.c.length > 0) {
        for (int i = 0; i < this.c.length; i++) {
            bundle2.putString(this.c[i], this.d[i]);
        }
    }
    bundle.putBundle("attributes", bundle2);
    if (this.f != null && this.f.size() > 0) {
        bundle.putParcelableArray("children", a(this.f));
    }
    return bundle;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:a.java

示例4: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(KEY_INSTANCE_STATE_PENDING_REQUEST, mPendingRequest);
    if (mPendingRequest == REQUEST_ADD_ACCOUNT) {
        outState.putParcelableArray(KEY_INSTANCE_STATE_EXISTING_ACCOUNTS, mExistingAccounts);
    }
    if (mSelectedItemIndex != SELECTED_ITEM_NONE) {
        if (mSelectedItemIndex == mAccounts.size()) {
            outState.putBoolean(KEY_INSTANCE_STATE_SELECTED_ADD_ACCOUNT, true);
        } else {
            outState.putBoolean(KEY_INSTANCE_STATE_SELECTED_ADD_ACCOUNT, false);
            outState.putString(KEY_INSTANCE_STATE_SELECTED_ACCOUNT_NAME,
                    mAccounts.get(mSelectedItemIndex).name);
        }
    }
    outState.putParcelableArrayList(KEY_INSTANCE_STATE_ACCOUNT_LIST, mAccounts);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:19,代码来源:ChooseTypeAndAccountActivity.java

示例5: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onSaveInstanceState(Bundle outState) {
    Parcelable[] achievementsConverted = null;

    if (achievementsToShow != null) {
        Object[] achievements = achievementsToShow.toArray();
        achievementsConverted = Arrays.copyOf(achievements, achievements.length, Parcelable[].class);
    }

    super.onSaveInstanceState(outState);

    outState.putBoolean(KEY_ACHIEVEMENT_OPEN, isAchievementOpen);
    outState.putBoolean(KEY_START_GUIDE_OPEN, isStartGuideOpen);
    outState.putBoolean(KEY_UPDATE_NOTIFIER_OPEN, isUpdateNotifierOpen);
    outState.putBoolean(KEY_INSTANT_FEEDBACK_OPEN, isInstantFeedbackOpen);
    outState.putBoolean(KEY_INSTANT_FEEDBACK_SHOWN, wasInstantFeedbackShown);
    outState.putBoolean(KEY_ALL_ACHIEVEMENTS_SHOWN, wereAllAchievementsShown);
    outState.putBoolean(KEY_START_GUIDE_SHOWN, wasStartGuideShown);
    outState.putBoolean(KEY_UPDATE_NOTIFIER_SHOWN, wasUpdateNotifierShown);
    outState.putParcelableArray(KEY_ALL_ACHIEVEMENTS, achievementsConverted);
}
 
开发者ID:mr-kojo,项目名称:Veggietizer,代码行数:22,代码来源:OverviewActivity.java

示例6: query

import android.os.Bundle; //导入方法依赖的package包/类
@SuppressLint("NewApi")
@Nullable
@Override
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
    String path = uri.getEncodedPath();
    if (!path.startsWith("/font/")
            || selectionArgs == null ||  selectionArgs[0] == null) {
        return null;
    }

    String name = path.substring("/font/".length());
    String[] w = selectionArgs[0].split(",");
    int[] weight = new int[w.length];
    for (int i = 0; i < w.length; i++) {
        weight[i] = Integer.parseInt(w[i]);
    }

    FontFamily[] families = FontManager.getFontFamily(getContext(), name, weight);

    Bundle bundle = new Bundle();
    bundle.putParcelableArray("data", families);

    AbstractCursor cursor = new SimpleCursor();
    cursor.setExtras(bundle);
    return cursor;
}
 
开发者ID:RikkaApps,项目名称:FontProvider,代码行数:27,代码来源:FontProvider.java

示例7: create

import android.os.Bundle; //导入方法依赖的package包/类
protected static <T extends Parcelable> ListDialogFragment<T> create(
        List<Selection<T>> options, Selection<T> current) {

    Bundle args = new Bundle();

    // Split value pairs to store them (since Selection does not implement Parcelable)
    String[] names = new String[options.size()];
    //noinspection unchecked
    T[] values = (T[]) new Parcelable[options.size()];

    for (int i = 0; i < options.size(); i++) {
        names[i] = options.get(i).getName();
        values[i] = options.get(i).getValue();
    }

    args.putStringArray(KEY_SELECTION_NAMES, names);
    args.putParcelableArray(KEY_SELECTION_VALUES, values);
    args.putInt(KEY_SELECTION_CURRENT, options.indexOf(current));

    ListDialogFragment<T> fragment = new ListDialogFragment<>();
    fragment.setArguments(args);
    return fragment;
}
 
开发者ID:marverenic,项目名称:Options,代码行数:24,代码来源:DialogListOption.java

示例8: toBundle

import android.os.Bundle; //导入方法依赖的package包/类
private static Bundle toBundle(JSONObject node) throws JSONException {
    Bundle bundle = new Bundle();
    @SuppressWarnings("unchecked")
    Iterator<String> fields = node.keys();
    while (fields.hasNext()) {
        String key = fields.next();
        Object value;
        value = node.get(key);

        if (value instanceof JSONObject) {
            bundle.putBundle(key, toBundle((JSONObject) value));
        } else if (value instanceof JSONArray) {
            JSONArray valueArr = (JSONArray) value;
            if (valueArr.length() == 0) {
                bundle.putStringArray(key, new String[0]);
            } else {
                Object firstNode = valueArr.get(0);
                if (firstNode instanceof JSONObject) {
                    Bundle[] bundles = new Bundle[valueArr.length()];
                    for (int i = 0; i < valueArr.length(); i++) {
                        bundles[i] = toBundle(valueArr.getJSONObject(i));
                    }
                    bundle.putParcelableArray(key, bundles);
                } else if (firstNode instanceof JSONArray) {
                    // we don't support nested arrays
                    throw new FacebookException("Nested arrays are not supported.");
                } else { // just use the string value
                    String[] arrValues = new String[valueArr.length()];
                    for (int i = 0; i < valueArr.length(); i++) {
                        arrValues[i] = valueArr.get(i).toString();
                    }
                    bundle.putStringArray(key, arrValues);
                }
            }
        } else {
            bundle.putString(key, value.toString());
        }
    }
    return bundle;
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:41,代码来源:AppLinkData.java

示例9: saveState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public Parcelable saveState() {
    Bundle bundle = (Bundle) super.saveState();
    // Never maintain any states from the base class, just null it out
    if(bundle != null)
        bundle.putParcelableArray("states", null);
    return bundle;
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:9,代码来源:DefaultStatePagerAdapter.java

示例10: getBundleForUnreadConversation

import android.os.Bundle; //导入方法依赖的package包/类
static Bundle getBundleForUnreadConversation(UnreadConversation uc) {
    if (uc == null) {
        return null;
    }
    Bundle b = new Bundle();
    String author = null;
    if (uc.getParticipants() != null && uc.getParticipants().length > 1) {
        author = uc.getParticipants()[0];
    }
    Parcelable[] messages = new Parcelable[uc.getMessages().length];
    for (int i = 0; i < messages.length; i++) {
        Bundle m = new Bundle();
        m.putString("text", uc.getMessages()[i]);
        m.putString(KEY_AUTHOR, author);
        messages[i] = m;
    }
    b.putParcelableArray(KEY_MESSAGES, messages);
    RemoteInput remoteInput = uc.getRemoteInput();
    if (remoteInput != null) {
        b.putParcelable(KEY_REMOTE_INPUT, fromCompatRemoteInput(remoteInput));
    }
    b.putParcelable(KEY_ON_REPLY, uc.getReplyPendingIntent());
    b.putParcelable(KEY_ON_READ, uc.getReadPendingIntent());
    b.putStringArray(KEY_PARTICIPANTS, uc.getParticipants());
    b.putLong(KEY_TIMESTAMP, uc.getLatestTimestamp());
    return b;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:28,代码来源:NotificationCompatApi21.java

示例11: newInstance

import android.os.Bundle; //导入方法依赖的package包/类
public static AspectRatioFragment newInstance(Set<AspectRatio> ratios,
                                              AspectRatio currentRatio) {
    final AspectRatioFragment fragment = new AspectRatioFragment();
    final Bundle args = new Bundle();
    args.putParcelableArray(ARG_ASPECT_RATIOS,
        ratios.toArray(new AspectRatio[ratios.size()]));
    args.putParcelable(ARG_CURRENT_ASPECT_RATIO, currentRatio);
    fragment.setArguments(args);
    return fragment;
}
 
开发者ID:lytcom,项目名称:CameraKitView,代码行数:11,代码来源:AspectRatioFragment.java

示例12: getBundleArrayFromBundle

import android.os.Bundle; //导入方法依赖的package包/类
public static Bundle[] getBundleArrayFromBundle(Bundle bundle, String key) {
    Parcelable[] array = bundle.getParcelableArray(key);
    if ((array instanceof Bundle[]) || array == null) {
        return (Bundle[]) array;
    }
    Bundle[] typedArray = (Bundle[]) Arrays.copyOf(array, array.length, Bundle[].class);
    bundle.putParcelableArray(key, typedArray);
    return typedArray;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:BundleUtil.java

示例13: put

import android.os.Bundle; //导入方法依赖的package包/类
public Bundler put(@NonNull String key, Parcelable[] value) {
    Bundle safeBundle = new Bundle();
    safeBundle.putParcelableArray(key, value);
    if (isValidBundleSize(safeBundle)) {
        bundle.putParcelableArray(key, value);
    }
    clearBundle(safeBundle);
    return this;
}
 
开发者ID:alphater,项目名称:garras,代码行数:10,代码来源:Bundler.java

示例14: getNotificationArrayFromBundle

import android.os.Bundle; //导入方法依赖的package包/类
private static Notification[] getNotificationArrayFromBundle(Bundle bundle, String key) {
    Parcelable[] array = bundle.getParcelableArray(key);
    if ((array instanceof Notification[]) || array == null) {
        return (Notification[]) array;
    }
    Notification[] typedArray = new Notification[array.length];
    for (int i = 0; i < array.length; i++) {
        typedArray[i] = (Notification) array[i];
    }
    bundle.putParcelableArray(key, typedArray);
    return typedArray;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:NotificationCompat.java

示例15: getBundleForAction

import android.os.Bundle; //导入方法依赖的package包/类
private static Bundle getBundleForAction(Action action) {
    Bundle bundle = new Bundle();
    bundle.putInt("icon", action.getIcon());
    bundle.putCharSequence("title", action.getTitle());
    bundle.putParcelable(KEY_ACTION_INTENT, action.getActionIntent());
    bundle.putBundle(KEY_EXTRAS, action.getExtras());
    bundle.putParcelableArray(KEY_REMOTE_INPUTS, RemoteInputCompatJellybean.toBundleArray(action.getRemoteInputs()));
    return bundle;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:NotificationCompatJellybean.java


注:本文中的android.os.Bundle.putParcelableArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。