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


Java Bundle.putStringArray方法代码示例

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


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

示例1: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    Parcelable p = this.mFragments.saveAllState();
    if (p != null) {
        outState.putParcelable(FRAGMENTS_TAG, p);
    }
    if (this.mPendingFragmentActivityResults.size() > 0) {
        outState.putInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG, this.mNextCandidateRequestIndex);
        int[] requestCodes = new int[this.mPendingFragmentActivityResults.size()];
        String[] fragmentWhos = new String[this.mPendingFragmentActivityResults.size()];
        for (int i = 0; i < this.mPendingFragmentActivityResults.size(); i++) {
            requestCodes[i] = this.mPendingFragmentActivityResults.keyAt(i);
            fragmentWhos[i] = (String) this.mPendingFragmentActivityResults.valueAt(i);
        }
        outState.putIntArray(ALLOCATED_REQUEST_INDICIES_TAG, requestCodes);
        outState.putStringArray(REQUEST_FRAGMENT_WHO_TAG, fragmentWhos);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:19,代码来源:FragmentActivity.java

示例2: newInstance

import android.os.Bundle; //导入方法依赖的package包/类
public static ChartletFragment newInstance(int[] thumbnailIds, int[] drawableIds, String[]
        strings, String imageUriStr) {
    if (thumbnailIds == null || thumbnailIds.length == 0 || drawableIds == null ||
            drawableIds.length == 0 || TextUtils.isEmpty(imageUriStr)) {
        return null;
    }
    ChartletFragment fragment = new ChartletFragment();
    Bundle args = new Bundle();
    args.putIntArray(KEY_DRAWABLE_IDS, drawableIds);
    args.putIntArray(KEY_THUMBNAIL_DRAWABLE_IDS, thumbnailIds);
    if (strings != null && strings.length > 0) {
        args.putStringArray(KEY_STRINGS, strings);
    }
    args.putString(KEY_URI_STR, imageUriStr);
    fragment.setArguments(args);
    return fragment;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:ChartletFragment.java

示例3: receive

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public Integer receive(Context context, Intent intent, Integer tmpWakeLockId) {
    Timber.i("RemoteControlReceiver.onReceive %s", intent);

    if (K9RemoteControl.K9_SET.equals(intent.getAction())) {
        RemoteControlService.set(context, intent, tmpWakeLockId);
        tmpWakeLockId = null;
    } else if (K9RemoteControl.K9_REQUEST_ACCOUNTS.equals(intent.getAction())) {
        try {
            Preferences preferences = Preferences.getPreferences(context);
            List<Account> accounts = preferences.getAccounts();
            String[] uuids = new String[accounts.size()];
            String[] descriptions = new String[accounts.size()];
            for (int i = 0; i < accounts.size(); i++) {
                //warning: account may not be isAvailable()
                Account account = accounts.get(i);

                uuids[i] = account.getUuid();
                descriptions[i] = account.getDescription();
            }
            Bundle bundle = getResultExtras(true);
            bundle.putStringArray(K9_ACCOUNT_UUIDS, uuids);
            bundle.putStringArray(K9_ACCOUNT_DESCRIPTIONS, descriptions);
        } catch (Exception e) {
            Timber.e(e, "Could not handle K9_RESPONSE_INTENT");
        }

    }

    return tmpWakeLockId;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:32,代码来源:RemoteControlReceiver.java

示例4: toBundle

import android.os.Bundle; //导入方法依赖的package包/类
Bundle toBundle() {
    Bundle bundle = new Bundle();
    bundle.putInt(KEY_POSITIVE_BUTTON, positiveButton);
    bundle.putInt(KEY_NEGATIVE_BUTTON, negativeButton);
    bundle.putString(KEY_RATIONALE_MESSAGE, rationaleMsg);
    bundle.putInt(KEY_REQUEST_CODE, requestCode);
    bundle.putStringArray(KEY_PERMISSIONS, permissions);

    return bundle;
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:11,代码来源:RationaleDialogConfig.java

示例5: newInstance

import android.os.Bundle; //导入方法依赖的package包/类
public static ShowRecordLogDialog newInstance(String[] suggestions) {
    ShowRecordLogDialog dialog = new ShowRecordLogDialog();
    Bundle args = new Bundle();
    args.putStringArray(QUERY_SUGGESTIONS, suggestions);
    dialog.setArguments(args);
    return dialog;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:8,代码来源:RecordLogDialogActivity.java

示例6: newInstance

import android.os.Bundle; //导入方法依赖的package包/类
public static ConfirmationDialogFragment newInstance(@StringRes int message,
                                                     String[] permissions, int requestCode, @StringRes int notGrantedMessage) {
    ConfirmationDialogFragment fragment = new ConfirmationDialogFragment();
    Bundle args = new Bundle();
    args.putInt(ARG_MESSAGE, message);
    args.putStringArray(ARG_PERMISSIONS, permissions);
    args.putInt(ARG_REQUEST_CODE, requestCode);
    args.putInt(ARG_NOT_GRANTED_MESSAGE, notGrantedMessage);
    fragment.setArguments(args);
    return fragment;
}
 
开发者ID:fengzhizi715,项目名称:Tess-TwoDemo,代码行数:12,代码来源:CameraActivity.java

示例7: 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:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:41,代码来源:AppLinkData.java

示例8: fromArrayToBundle

import android.os.Bundle; //导入方法依赖的package包/类
public static void fromArrayToBundle(Bundle bundle, String key, Object array) {
    if (bundle != null && !TextUtils.isEmpty(key) && array != null) {
        if (array instanceof String[]) {
            bundle.putStringArray(key, (String[]) ((String[]) array));
        } else if (array instanceof byte[]) {
            bundle.putByteArray(key, (byte[]) ((byte[]) array));
        } else if (array instanceof short[]) {
            bundle.putShortArray(key, (short[]) ((short[]) array));
        } else if (array instanceof int[]) {
            bundle.putIntArray(key, (int[]) ((int[]) array));
        } else if (array instanceof long[]) {
            bundle.putLongArray(key, (long[]) ((long[]) array));
        } else if (array instanceof float[]) {
            bundle.putFloatArray(key, (float[]) ((float[]) array));
        } else if (array instanceof double[]) {
            bundle.putDoubleArray(key, (double[]) ((double[]) array));
        } else if (array instanceof boolean[]) {
            bundle.putBooleanArray(key, (boolean[]) ((boolean[]) array));
        } else if (array instanceof char[]) {
            bundle.putCharArray(key, (char[]) ((char[]) array));
        } else {
            if (!(array instanceof JSONArray)) {
                throw new IllegalArgumentException("Unknown array type " + array.getClass());
            }

            ArrayList arraylist = new ArrayList();
            JSONArray jsonArray = (JSONArray) array;
            Iterator it = jsonArray.iterator();

            while (it.hasNext()) {
                JSONObject object = (JSONObject) it.next();
                arraylist.add(fromJsonToBundle(object));
            }

            bundle.putParcelableArrayList(key, arraylist);
        }

    }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:40,代码来源:ArgumentsUtil.java

示例9: a

import android.os.Bundle; //导入方法依赖的package包/类
private StringBuffer a(StringBuffer stringBuffer, Bundle bundle) {
    f.c(f.d, "fillShareToQQParams() --start");
    ArrayList stringArrayList = bundle.getStringArrayList("imageUrl");
    Object string = bundle.getString("appName");
    int i = bundle.getInt("req_type", 1);
    String string2 = bundle.getString("title");
    String string3 = bundle.getString("summary");
    bundle.putString("appId", this.mToken.getAppId());
    bundle.putString("sdkp", "a");
    bundle.putString(SocializeProtocolConstants.PROTOCOL_KEY_VERSION, Constants.SDK_VERSION);
    bundle.putString("status_os", VERSION.RELEASE);
    bundle.putString("status_machine", Build.MODEL);
    String str = "...";
    if (!Util.isEmpty(string2) && string2.length() > 40) {
        bundle.putString("title", string2.substring(0, 40) + "...");
    }
    if (!Util.isEmpty(string3) && string3.length() > 80) {
        bundle.putString("summary", string3.substring(0, 80) + "...");
    }
    if (!TextUtils.isEmpty(string)) {
        bundle.putString("site", string);
    }
    if (stringArrayList != null) {
        int size = stringArrayList.size();
        String[] strArr = new String[size];
        for (int i2 = 0; i2 < size; i2++) {
            strArr[i2] = (String) stringArrayList.get(i2);
        }
        bundle.putStringArray("imageUrl", strArr);
    }
    bundle.putString("type", String.valueOf(i));
    stringBuffer.append(com.alipay.sdk.sys.a.b + Util.encodeUrl(bundle).replaceAll("\\+", "%20"));
    f.c(f.d, "fillShareToQQParams() --end");
    return stringBuffer;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:36,代码来源:QzoneShare.java

示例10: showAlertDialog

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * 展示一个底部显示的对话框
 *
 * @param title           标题 可为空
 * @param msg             内容 可为空
 * @param accentStrs      高亮显示的文本item 可为空
 * @param strs            普通item  可为空
 * @param onClickListener 点击事件
 */
public static void showAlertDialog(String title, String msg, String[] accentStrs, String[] strs, OnItemClickListener onClickListener) {
    Message message = new Message();
    message.what = SHOW_ALERTVIEW_BOTTOM;
    message.obj = onClickListener;
    Bundle bundle = new Bundle();
    bundle.putString("title", title);
    bundle.putString("msg", msg);
    bundle.putStringArray("accentStrs", accentStrs);
    bundle.putStringArray("strs", strs);
    message.setData(bundle);
    EventBus.getDefault().post(message, APPMANAGER_MESSAGE);
}
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:22,代码来源:ArmsUtils.java

示例11: checkContactGroupPermissions

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * Check if the user has granted the contacts group permission
 *
 * @param ctx the application context
 * @return true if the permissions have been granted. False if they have been denied or are
 * required to be requested.
 */
public static boolean checkContactGroupPermissions(@NonNull final Context ctx) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "checkContactGroupPermissions");
    }

    switch (ContextCompat.checkSelfPermission(ctx, android.Manifest.permission.GET_ACCOUNTS)) {

        case PackageManager.PERMISSION_GRANTED:
            if (DEBUG) {
                MyLog.i(CLS_NAME, "checkContactGroupPermissions: PERMISSION_GRANTED");
            }
            return true;
        case PackageManager.PERMISSION_DENIED:
        default:
            if (DEBUG) {
                MyLog.w(CLS_NAME, "checkContactGroupPermissions: PERMISSION_DENIED");
            }

            final Intent intent = new Intent(ctx, ActivityPermissionDialog.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

            final Bundle bundle = new Bundle();
            bundle.putStringArray(REQUESTED_PERMISSION, new String[]{android.Manifest.permission.GET_ACCOUNTS});
            bundle.putInt(REQUESTED_PERMISSION_ID, REQUEST_GROUP_CONTACTS);

            intent.putExtras(bundle);

            ctx.startActivity(intent);
            return false;
    }
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:39,代码来源:PermissionHelper.java

示例12: newInstance

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * Constructs a new instance of the important sites dialog fragment.
 * @param importantDomains The list of important domains to display.
 * @param importantDomainReasons The reasons for choosing each important domain.
 * @param faviconURLs The list of favicon urls that correspond to each importantDomains.
 * @return An instance of ConfirmImportantSitesDialogFragment with the bundle arguments set.
 */
public static ConfirmImportantSitesDialogFragment newInstance(
        String[] importantDomains, int[] importantDomainReasons, String[] faviconURLs) {
    ConfirmImportantSitesDialogFragment dialogFragment =
            new ConfirmImportantSitesDialogFragment();
    Bundle bundle = new Bundle();
    bundle.putStringArray(IMPORTANT_DOMAINS_TAG, importantDomains);
    bundle.putIntArray(IMPORTANT_DOMAIN_REASONS_TAG, importantDomainReasons);
    bundle.putStringArray(FAVICON_URLS_TAG, faviconURLs);
    dialogFragment.setArguments(bundle);
    return dialogFragment;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:19,代码来源:ConfirmImportantSitesDialogFragment.java

示例13: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
public void onSaveInstanceState(Bundle outBundle) {
    String[] keys = new String[channelIds.size()];
    long[] values = new long[channelIds.size()];
    Iterator<Map.Entry<String, Long>> it = channelIds.entrySet().iterator();
    int i = 0;
    while (it.hasNext()) {
        Map.Entry<String, Long> e = it.next();
        keys[i] = e.getKey();
        values[i] = e.getValue();
        ++i;
    }
    outBundle.putStringArray("channel_ids_keys", keys);
    outBundle.putLongArray("channel_ids_values", values);
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:15,代码来源:ChatPagerAdapter.java

示例14: putStringArray

import android.os.Bundle; //导入方法依赖的package包/类
public void putStringArray(Bundle state, String key, String[] x) {
    state.putStringArray(key + baseKey, x);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Injector.java

示例15: assembleBundle

import android.os.Bundle; //导入方法依赖的package包/类
public Bundle assembleBundle() {
    User user = new User();
    user.setAge(90);
    user.setGender(1);
    user.setName("kitty");

    Address address = new Address();
    address.setCity("HangZhou");
    address.setProvince("ZheJiang");

    Bundle extras = new Bundle();
    extras.putString("extra", "from extras");


    ArrayList<String> stringList = new ArrayList<>();
    stringList.add("Java");
    stringList.add("C#");
    stringList.add("Kotlin");

    ArrayList<String> stringArrayList = new ArrayList<>();
    stringArrayList.add("American");
    stringArrayList.add("China");
    stringArrayList.add("England");

    ArrayList<Integer> intArrayList = new ArrayList<>();
    intArrayList.add(100);
    intArrayList.add(101);
    intArrayList.add(102);

    ArrayList<Integer> intList = new ArrayList<>();
    intList.add(10011);
    intList.add(10111);
    intList.add(10211);

    ArrayList<Address> addressList = new ArrayList<>();
    addressList.add(new Address("JiangXi", "ShangRao", null));
    addressList.add(new Address("ZheJiang", "NingBo", null));

    Address[] addressArray = new Address[]{
            new Address("Beijing", "Beijing", null),
            new Address("Shanghai", "Shanghai", null),
            new Address("Guangzhou", "Guangzhou", null)
    };
    Bundle bundle = new Bundle();
    bundle.putSerializable("user", user);
    bundle.putParcelable("address", address);
    bundle.putParcelableArrayList("addressList", addressList);
    bundle.putParcelableArray("addressArray", addressArray);
    bundle.putString("param", "chiclaim");
    bundle.putStringArray("stringArray", new String[]{"a", "b", "c"});
    bundle.putStringArrayList("stringArrayList", stringList);
    bundle.putStringArrayList("stringList", stringArrayList);
    bundle.putByte("byte", (byte) 2);
    bundle.putByteArray("byteArray", new byte[]{1, 2, 3, 4, 5});
    bundle.putInt("age", 33);
    bundle.putIntArray("intArray", new int[]{10, 11, 12, 13});
    bundle.putIntegerArrayList("intList", intList);
    bundle.putIntegerArrayList("intArrayList", intArrayList);
    bundle.putChar("chara", 'c');
    bundle.putCharArray("charArray", "chiclaim".toCharArray());
    bundle.putShort("short", (short) 1000000);
    bundle.putShortArray("shortArray", new short[]{(short) 10.9, (short) 11.9});
    bundle.putDouble("double", 1200000);
    bundle.putDoubleArray("doubleArray", new double[]{1232, 9999, 8789, 3.1415926});
    bundle.putLong("long", 999999999);
    bundle.putLongArray("longArray", new long[]{1000, 2000, 3000});
    bundle.putFloat("float", 333);
    bundle.putFloatArray("floatArray", new float[]{12.9f, 234.9f});
    bundle.putBoolean("boolean", true);
    bundle.putBooleanArray("booleanArray", new boolean[]{true, false, true});

    return bundle;
}
 
开发者ID:chiclaim,项目名称:MRouter,代码行数:74,代码来源:MainActivity.java


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