Example usage for android.os Bundle putStringArray

List of usage examples for android.os Bundle putStringArray

Introduction

In this page you can find the example usage for android.os Bundle putStringArray.

Prototype

public void putStringArray(@Nullable String key, @Nullable String[] value) 

Source Link

Document

Inserts a String array value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:uk.org.rivernile.edinburghbustracker.android.fragments.general.BusStopMapFragment.java

/**
 * Refresh the bus stop marker icons on the map. This may be because the
 * camera has moved, a configuration change has happened or the user has
 * selected services to filter by./*from ww w  . ja  v  a 2 s .  c om*/
 * 
 * @param position If a CameraPosition is available, send it in so that it
 * doesn't need to be looked up again. If it's not available, use null.
 */
private void refreshBusStops(CameraPosition position) {
    if (map == null || !isAdded()) {
        return;
    }

    // Populate the CameraPosition if it wasn't given.
    if (position == null) {
        position = map.getCameraPosition();
    }

    // Get the visible bounds.
    final LatLngBounds lastVisibleBounds = map.getProjection().getVisibleRegion().latLngBounds;
    final Bundle b = new Bundle();

    // Populate the Bundle of arguments for the bus stops Loader.
    b.putDouble(LOADER_ARG_MIN_X, lastVisibleBounds.southwest.latitude);
    b.putDouble(LOADER_ARG_MIN_Y, lastVisibleBounds.southwest.longitude);
    b.putDouble(LOADER_ARG_MAX_X, lastVisibleBounds.northeast.latitude);
    b.putDouble(LOADER_ARG_MAX_Y, lastVisibleBounds.northeast.longitude);
    b.putFloat(LOADER_ARG_ZOOM, position.zoom);

    // If there are chosen services, then set the filtered services
    // argument.
    if (chosenServices != null && chosenServices.length > 0) {
        b.putStringArray(LOADER_ARG_FILTERED_SERVICES, chosenServices);
    }

    // Start the bus stops Loader.
    getLoaderManager().restartLoader(LOADER_ID_BUS_STOPS, b, this);
}

From source file:github.popeen.dsub.activity.SubsonicActivity.java

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    super.onSaveInstanceState(savedInstanceState);
    String[] ids = new String[backStack.size() + 1];
    ids[0] = currentFragment.getTag();// w  w w . j a  v a 2 s . co  m
    int i = 1;
    for (SubsonicFragment frag : backStack) {
        ids[i] = frag.getTag();
        i++;
    }
    savedInstanceState.putStringArray(Constants.MAIN_BACK_STACK, ids);
    savedInstanceState.putInt(Constants.MAIN_BACK_STACK_SIZE, backStack.size() + 1);
    savedInstanceState.putInt(Constants.FRAGMENT_POSITION, lastSelectedPosition);
}

From source file:cat.wuyingren.rorhelper.activities.MainActivity.java

private void showManageSenatorDialog(boolean kill, boolean statesman) {

    if (isActionPossible()) {
        ManageSenatorDialogFragment dialog = new ManageSenatorDialogFragment();

        Bundle args = new Bundle();
        args.putBoolean(ManageSenatorDialogFragment.ARG_MODE, kill);
        args.putBoolean(ManageSenatorDialogFragment.ARG_TYPE, statesman);
        args.putLong(ManageSenatorDialogFragment.ARG_GAMEID, currentGameId);
        if (!kill) {
            String[] keys;/*from w w w.  jav a2 s. c  om*/
            ArrayList<String> values = new ArrayList<String>();
            if (statesman) {
                keys = new String[statesmanMap.size()];
                keys = statesmanMap.keySet().toArray(keys);

                for (String key : keys) {
                    values.add(statesmanMap.get(key).getName());
                }
            } else {
                keys = new String[senatorMap.size()];
                keys = senatorMap.keySet().toArray(keys);

                for (String key : keys) {
                    values.add(senatorMap.get(key).getName());
                }
            }

            args.putStringArray(ManageSenatorDialogFragment.ARG_ARRAY, keys);
            args.putStringArrayList(ManageSenatorDialogFragment.ARG_VALUES, values);
        }
        dialog.setArguments(args);
        dialog.show(getSupportFragmentManager(), "");
    }
}

From source file:cgeo.geocaching.cgeocaches.java

public void removeFromHistory() {
    final List<Geocache> caches = adapter.getCheckedOrAllCaches();
    final String[] geocodes = new String[caches.size()];
    for (int i = 0; i < geocodes.length; i++) {
        geocodes[i] = caches.get(i).getGeocode();
    }/*from w w w.ja  v  a 2  s . c o  m*/
    Bundle b = new Bundle();
    b.putStringArray(Intents.EXTRA_CACHELIST, geocodes);
    getSupportLoaderManager().initLoader(CacheListLoaderType.REMOVE_FROM_HISTORY.ordinal(), b, this);
}

From source file:com.vanrui.MediaPaltform.Activity.SimpleImageActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    int frIndex = getIntent().getIntExtra(Constants.Extra.FRAGMENT_INDEX, 0);
    String[] picArray = getIntent().getStringArrayExtra(Constants.Media_Type.TAG_PIC_ARRAY);
    Fragment fr;//from w ww .j ava2  s  . c om
    String tag;
    switch (frIndex) {
    default:
    case ImageGridFragment.VIDEO:
        tag = ImageGridFragment.class.getSimpleName();
        fr = getSupportFragmentManager().findFragmentByTag(tag);
        if (fr == null) {
            ImageGridFragment imageGridFragmentVideo = new ImageGridFragment();
            Bundle bundle = new Bundle();
            bundle.putString(Constants.Media_Type.TAG, Constants.Media_Type.VIDEO);
            imageGridFragmentVideo.setArguments(bundle);
            fr = imageGridFragmentVideo;
        }
        break;
    case ImageGridFragment.IMAGE:
        tag = ImageGridFragment.class.getSimpleName();
        fr = getSupportFragmentManager().findFragmentByTag(tag);
        if (fr == null) {
            ImageGridFragment imageGridFragmentVideo = new ImageGridFragment();
            Bundle bundle = new Bundle();
            bundle.putString(Constants.Media_Type.TAG, Constants.Media_Type.PICTURE);
            imageGridFragmentVideo.setArguments(bundle);
            fr = imageGridFragmentVideo;
        }
        break;
    case ImageGridFragment.WEB:
        tag = ImageGridFragment.class.getSimpleName();
        fr = getSupportFragmentManager().findFragmentByTag(tag);
        if (fr == null) {
            ImageGridFragment imageGridFragmentVideo = new ImageGridFragment();
            Bundle bundle = new Bundle();
            bundle.putString(Constants.Media_Type.TAG, Constants.Media_Type.WEB);
            imageGridFragmentVideo.setArguments(bundle);
            fr = imageGridFragmentVideo;
        }
        break;
    case ImagePagerFragment.INDEX:
        tag = ImagePagerFragment.class.getSimpleName();
        fr = getSupportFragmentManager().findFragmentByTag(tag);
        if (fr == null) {

            ImagePagerFragment imagePagerFragment = new ImagePagerFragment();
            Bundle bundle = new Bundle();
            bundle.putStringArray(Constants.Media_Type.TAG_PIC_ARRAY, picArray);
            imagePagerFragment.setArguments(bundle);
            fr = imagePagerFragment;
        }
        break;
    }
    getSupportFragmentManager().beginTransaction().replace(android.R.id.content, fr, tag).commit();
}

From source file:com.ichi2.anki.NoteEditor.java

@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
    Timber.i("Saving instance");
    savedInstanceState.putInt("caller", mCaller);
    savedInstanceState.putBoolean("addFact", mAddNote);
    savedInstanceState.putLong("did", mCurrentDid);
    savedInstanceState.putStringArray("tags", mSelectedTags.toArray(new String[mSelectedTags.size()]));
    Bundle fields = new Bundle();
    // Save the content of all the note fields. We use the field's ord as the key to
    // easily map the fields correctly later.
    for (FieldEditText e : mEditFields) {
        fields.putString(Integer.toString(e.getOrd()), e.getText().toString());
    }/*from  ww w . ja v  a 2s  . com*/
    savedInstanceState.putBundle("editFields", fields);
    super.onSaveInstanceState(savedInstanceState);
}

From source file:tv.ouya.sdk.CordovaOuyaPlugin.java

public void initOuyaPlugin(final JSONArray jsonArray) {
    if (null == jsonArray) {
        JSONObject result = createError(0, "initOuyaPlugin jsonArray is null!");
        sCallbackInitOuyaPlugin.error(result);
        return;//  ww  w .  ja  v a  2  s  .  c o m
    }

    if (sEnableLogging) {
        Log.i(TAG, "initOuyaPlugin jsonArray=" + jsonArray.toString());
    }

    sInitCompletedListener = new CancelIgnoringOuyaResponseListener<Bundle>() {
        @Override
        public void onSuccess(final Bundle info) {
            if (sEnableLogging) {
                Log.i(TAG, "sInitCompletedListener: onSuccess");
            }
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, "SUCCESS");
                    pluginResult.setKeepCallback(false);
                    sCallbackInitOuyaPlugin.sendPluginResult(pluginResult);
                }
            });
        }

        @Override
        public void onFailure(final int errorCode, final String errorMessage, final Bundle optionalData) {
            if (sEnableLogging) {
                Log.i(TAG, "sInitCompletedListener: onFailure errorCode=" + errorCode + " errorMessage="
                        + errorMessage);
            }
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = createError(errorCode, errorMessage);
                    PluginResult pluginResult = new PluginResult(PluginResult.Status.ERROR, result);
                    pluginResult.setKeepCallback(false);
                    sCallbackInitOuyaPlugin.sendPluginResult(pluginResult);
                }
            });
        }
    };

    sRequestGamerInfoListener = new CancelIgnoringOuyaResponseListener<GamerInfo>() {
        @Override
        public void onSuccess(final GamerInfo info) {
            Log.i(TAG, "sRequestGamerInfoListener: onSuccess");
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = new JSONObject();
                    try {
                        result.put("username", info.getUsername());
                        result.put("uuid", info.getUuid());
                    } catch (JSONException e) {
                        result = createError(0, "Failed to create results!");
                        sCallbackRequestGamerInfo.error(result);
                        return;
                    }
                    sCallbackRequestGamerInfo.success(result);
                }
            });
        }

        @Override
        public void onFailure(final int errorCode, final String errorMessage, final Bundle optionalData) {
            Log.i(TAG, "sRequestGamerInfoListener: onFailure errorCode=" + errorCode + " errorMessage="
                    + errorMessage);
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = createError(errorCode, errorMessage);
                    sCallbackRequestGamerInfo.error(result);
                }
            });
        }
    };

    sRequestProductsListener = new CancelIgnoringOuyaResponseListener<List<Product>>() {
        @Override
        public void onSuccess(final List<Product> products) {
            Log.i(TAG, "sRequestProductsListener: onSuccess");
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONArray result = new JSONArray();
                    try {
                        int i = 0;
                        for (Product product : products) {
                            JSONObject jsonObject = new JSONObject();
                            jsonObject.put("description", product.getDescription());
                            jsonObject.put("identifier", product.getIdentifier());
                            jsonObject.put("name", product.getName());
                            jsonObject.put("localPrice", product.getLocalPrice());
                            result.put(i, jsonObject);
                            ++i;
                        }
                    } catch (JSONException e) {
                        JSONObject error = createError(0, "Failed to create results!");
                        sCallbackRequestProducts.error(error);
                        return;
                    }
                    sCallbackRequestProducts.success(result);
                }
            });
        }

        @Override
        public void onFailure(final int errorCode, final String errorMessage, final Bundle optionalData) {
            Log.i(TAG, "sRequestProductsListener: onFailure errorCode=" + errorCode + " errorMessage="
                    + errorMessage);
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = createError(errorCode, errorMessage);
                    sCallbackRequestProducts.error(result);
                }
            });
        }
    };

    sRequestPurchaseListener = new OuyaResponseListener<PurchaseResult>() {

        @Override
        public void onSuccess(final PurchaseResult purchaseResult) {
            Log.i(TAG, "sRequestPurchaseListener: onSuccess");
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = new JSONObject();
                    try {
                        result.put("productIdentifier", purchaseResult.getProductIdentifier());
                    } catch (JSONException e) {
                        result = createError(0, "Failed to set productIdentifier!");
                        sCallbackRequestPurchase.error(result);
                        return;
                    }
                    sCallbackRequestPurchase.success(result);
                }
            });
        }

        @Override
        public void onFailure(final int errorCode, final String errorMessage, final Bundle optionalData) {
            Log.i(TAG, "sRequestPurchaseListener: onFailure errorCode=" + errorCode + " errorMessage="
                    + errorMessage);
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = createError(errorCode, errorMessage);
                    sCallbackRequestPurchase.error(result);
                }
            });
        }

        @Override
        public void onCancel() {
            Log.i(TAG, "sRequestPurchaseListener: onCancel");
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = createError(0, "Purchase was cancelled!");
                    sCallbackRequestPurchase.error(result);
                }
            });
        }
    };

    sRequestReceiptsListener = new OuyaResponseListener<Collection<Receipt>>() {

        @Override
        public void onSuccess(final Collection<Receipt> receipts) {
            Log.i(TAG, "requestReceipts onSuccess: received " + receipts.size() + " receipts");
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONArray result = new JSONArray();
                    try {
                        int i = 0;
                        for (Receipt receipt : receipts) {
                            JSONObject jsonObject = new JSONObject();
                            jsonObject.put("currency", receipt.getCurrency());
                            jsonObject.put("generatedDate", receipt.getGeneratedDate());
                            jsonObject.put("identifier", receipt.getIdentifier());
                            jsonObject.put("localPrice", receipt.getLocalPrice());
                            result.put(i, jsonObject);
                            ++i;
                        }
                    } catch (JSONException e) {
                        JSONObject error = createError(0, "Failed to create results!");
                        sCallbackRequestReceipts.error(error);
                        return;
                    }
                    sCallbackRequestReceipts.success(result);
                }
            });
        }

        @Override
        public void onFailure(final int errorCode, final String errorMessage, final Bundle optionalData) {
            Log.e(TAG, "requestReceipts onFailure: errorCode=" + errorCode + " errorMessage=" + errorMessage);
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = createError(errorCode, errorMessage);
                    sCallbackRequestReceipts.error(result);
                }
            });
        }

        @Override
        public void onCancel() {
            Log.i(TAG, "requestReceipts onCancel");
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = createError(0, "Request Receipts was cancelled!");
                    sCallbackRequestReceipts.error(result);
                }
            });
        }
    };

    Runnable runnable = new Runnable() {
        public void run() {

            Bundle developerInfo = new Bundle();

            try {
                for (int index = 0; index < jsonArray.length(); ++index) {
                    JSONObject jsonObject = jsonArray.getJSONObject(index);
                    String name = jsonObject.getString("key");
                    String value = jsonObject.getString("value");
                    if (null == name || null == value) {
                        continue;
                    }
                    if (name.equals("tv.ouya.product_id_list")) {
                        String[] productIds = value.split(",");
                        if (null == productIds) {
                            continue;
                        }
                        developerInfo.putStringArray("tv.ouya.product_id_list", productIds);
                    } else {
                        Log.i(TAG, "initOuyaPlugin name=" + name + " value=" + value);
                        developerInfo.putString(name, value);
                    }
                }
            } catch (JSONException e) {
                e.printStackTrace();
                cordova.getThreadPool().execute(new Runnable() {
                    public void run() {
                        JSONObject result = createError(0, "initOuyaPlugin Failed to read JSON data!");
                        sCallbackInitOuyaPlugin.error(result);
                    }
                });

                return;
            }

            byte[] applicationKey = null;

            // load the application key from assets
            try {
                AssetManager assetManager = cordova.getActivity().getAssets();
                InputStream inputStream = assetManager.open("key.der", AssetManager.ACCESS_BUFFER);
                applicationKey = new byte[inputStream.available()];
                inputStream.read(applicationKey);
                inputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
                cordova.getThreadPool().execute(new Runnable() {
                    public void run() {
                        JSONObject result = createError(0, "Failed to load signing key!");
                        sCallbackInitOuyaPlugin.error(result);
                    }
                });

                return;
            }

            if (null == applicationKey) {
                cordova.getThreadPool().execute(new Runnable() {
                    public void run() {
                        JSONObject result = createError(0, "Failed to load signing key!");
                        sCallbackInitOuyaPlugin.error(result);
                    }
                });
                return;
            }

            developerInfo.putByteArray(OuyaFacade.OUYA_DEVELOPER_PUBLIC_KEY, applicationKey);

            try {
                sOuyaFacade = OuyaFacade.getInstance();
            } catch (Exception e) {
                e.printStackTrace();
                cordova.getThreadPool().execute(new Runnable() {
                    public void run() {
                        JSONObject result = createError(0, "Failed to get OUYA Facade instance!");
                        sCallbackInitOuyaPlugin.error(result);
                    }
                });
                return;
            }

            /*
            try {
            sOuyaFacade.registerInitCompletedListener(sInitCompletedListener);
            } catch (Exception e) {
            e.printStackTrace();
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    JSONObject result = createError(0, "Failed to register init completed listener!");
                    sCallbackInitOuyaPlugin.error(result);
                }
            });
            return;
            }
            */

            try {
                sOuyaFacade.init(cordova.getActivity(), developerInfo);
            } catch (Exception e) {
                e.printStackTrace();
                cordova.getThreadPool().execute(new Runnable() {
                    public void run() {
                        JSONObject result = createError(0, "Failed to initialize the OuyaFacade!");
                        sCallbackInitOuyaPlugin.error(result);
                    }
                });
                return;
            }

            /*
            cordova.getThreadPool().execute(new Runnable() {
            public void run() {
                PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, "WAIT");
                pluginResult.setKeepCallback(true);
                sCallbackInitOuyaPlugin.sendPluginResult(pluginResult);
            }
            });
            */

            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, "SUCCESS");
                    pluginResult.setKeepCallback(false);
                    sCallbackInitOuyaPlugin.sendPluginResult(pluginResult);
                }
            });
        }
    };
    cordova.getActivity().runOnUiThread(runnable);
}

From source file:com.andrewshu.android.reddit.profile.ProfileActivity.java

@Override
protected void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
    state.putString(Constants.USERNAME_KEY, mUsername);
    state.putString(Constants.CommentsSort.SORT_BY_KEY, mSortByUrl);
    state.putString(Constants.JUMP_TO_THREAD_ID_KEY, mJumpToThreadId);
    state.putString(Constants.AFTER_KEY, mAfter);
    state.putString(Constants.BEFORE_KEY, mBefore);
    state.putInt(Constants.THREAD_COUNT_KEY, mCount);
    state.putString(Constants.LAST_AFTER_KEY, mLastAfter);
    state.putString(Constants.LAST_BEFORE_KEY, mLastBefore);
    state.putInt(Constants.THREAD_LAST_COUNT_KEY, mLastCount);
    state.putStringArray(Constants.KARMA_KEY, mKarma);
    state.putParcelable(Constants.VOTE_TARGET_THING_INFO_KEY, mVoteTargetThingInfo);
}

From source file:org.planetmono.dcuploader.ActivityUploader.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    if (tempFile != null)
        outState.putString("tempfile", tempFile.getAbsolutePath());
    if (target != null)
        outState.putString("target", target);
    if (tempFiles.size() > 0)
        outState.putStringArrayList("tempfiles", tempFiles);
    if (contents.size() > 0) {
        String[] carr = new String[contents.size()];

        int t = 0;
        for (Uri u : contents)
            carr[t++] = u.toString();// w w w.  jav a  2s  .c  om

        outState.putStringArray("contents", carr);
    }
}

From source file:me.xiaopan.android.inject.sample.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    listView = new ListView(getBaseContext());
    setContentView(listView);//w  w  w .  j  a v  a  2 s.co m

    // SharedPreferences?
    PreferenceUtils.putBoolean(getBaseContext(), KEY_BOOLEAN, true);
    PreferenceUtils.putFloat(getBaseContext(), KEY_FLOAT, 10000f);
    PreferenceUtils.putInt(getBaseContext(), KEY_INT, 2000);
    PreferenceUtils.putLong(getBaseContext(), KEY_LONG, 50000);
    PreferenceUtils.putString(getBaseContext(), KEY_STRING, "Preference String");
    Set<String> stringSet = new HashSet<String>();
    stringSet.add("String Set 1");
    stringSet.add("String Set 2");
    stringSet.add("String Set 3");
    stringSet.add("String Set 4");
    PreferenceUtils.putStringSet(getBaseContext(), KEY_STRING_SET, stringSet);
    MyBean bean2 = new MyBean();
    bean2.setEmail("sky@xiaopan.me2");
    bean2.setName("?2");
    bean2.setSex("2");
    PreferenceUtils.putObject(getBaseContext(), KEY_JSON, bean2);
    PreferenceUtils.putString(getBaseContext(), KEY_ENUM, Sex.WOMAN.name());

    // ??
    String[] items = new String[] { "", "?", "FragmentDialog",
            "InjectAdapter", "InjectExpandableListAdapter" };
    listView.setAdapter(new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1,
            android.R.id.text1, items));
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position <= 2) {
                Bundle bundle = new Bundle();
                bundle.putBoolean(MainActivity.PARAM_BOOLEAN, true);
                bundle.putBooleanArray(MainActivity.PARAM_BOOLEAN_ARRAY, new boolean[] { true, false, true });
                bundle.putByte(MainActivity.PARAM_BYTE, (byte) 110);
                bundle.putByteArray(MainActivity.PARAM_BYTE_ARRAY, new byte[] { 111, 112, 113 });
                bundle.putChar(MainActivity.PARAM_CHAR, 'R');
                bundle.putCharArray(MainActivity.PARAM_CHAR_ARRAY, new char[] { 'c', 'h', 'a', 'r' });
                bundle.putCharSequence(MainActivity.PARAM_CHAR_SEQUENCE, "CharSequence");
                bundle.putCharSequenceArray(MainActivity.PARAM_CHAR_SEQUENCE_ARRAY,
                        new CharSequence[] { "Char", " ", "Sequence" });
                bundle.putDouble(MainActivity.PARAM_DOUBLE, 12.00d);
                bundle.putDoubleArray(MainActivity.PARAM_DOUBLE_ARRAY, new double[] { 12.01d, 12.02d, 12.03d });
                bundle.putFloat(MainActivity.PARAM_FLOAT, 13.00f);
                bundle.putFloatArray(MainActivity.PARAM_FLOAT_ARRAY, new float[] { 13.01f, 13.02f, 13.03f });
                bundle.putInt(MainActivity.PARAM_INT, 120);
                bundle.putIntArray(MainActivity.PARAM_INT_ARRAY, new int[] { 121, 122, 123, });
                bundle.putLong(MainActivity.PARAM_LONG, 12345);
                bundle.putLongArray(MainActivity.PARAM_LONG_ARRAY, new long[] { 12346, 12347, 12348 });
                bundle.putShort(MainActivity.PARAM_SHORT, (short) 2);
                bundle.putShortArray(MainActivity.PARAM_SHORT_ARRAY, new short[] { 3, 4, 5 });
                bundle.putString(MainActivity.PARAM_STRING, "String");
                bundle.putStringArray(MainActivity.PARAM_STRING_ARRAY,
                        new String[] { "String1", "String2", "String3" });

                // ??JSONBundle
                MyBean bean = new MyBean();
                bean.setEmail("sky@xiaopan.me");
                bean.setName("?");
                bean.setSex("");
                bundle.putString(PARAM_STRING_JSON, new Gson().toJson(bean));

                bundle.putString(MainActivity.PARAM_STRING_ENUM, Sex.WOMAN.name());

                // 
                ArrayList<String> stringList = new ArrayList<String>();
                stringList.add("ArrayList String 1");
                stringList.add("ArrayList String 2");
                stringList.add("ArrayList String 3");
                bundle.putStringArrayList(MainActivity.PARAM_STRING_ARRAY_LIST, stringList);
                switch (position) {
                case 0:
                    Second.SECOND_CHRONOGRAPH.lap();
                    Intent intent = new Intent(getBaseContext(), InjectTestActivity.class);
                    intent.putExtras(bundle);
                    startActivity(intent);
                    break;
                case 1:
                    Second.SECOND_CHRONOGRAPH.lap();
                    Intent intent2 = new Intent(getBaseContext(), NormalActivity.class);
                    intent2.putExtras(bundle);
                    startActivity(intent2);
                    break;
                case 2:
                    Second.SECOND_CHRONOGRAPH.lap();
                    new TestDialogFragment().show(getSupportFragmentManager(), "");
                    break;
                }
            } else {
                Class<?> targetClass = null;
                if (position == 3) {
                    targetClass = InjectAdapterActivity.class;
                } else if (position == 4) {
                    targetClass = InjectExpandableListAdapterActivity.class;
                }
                if (targetClass != null) {
                    startActivity(new Intent(getBaseContext(), targetClass));
                }
            }
        }
    });
}