In Android, since intent can pass key-value pair data, why should intent and bundle be used together?
大家讲道理
大家讲道理 2017-05-16 13:35:37
0
3
789

As mentioned in the title, both bundle and intent can store key-value pair data. In logarithmic cases, just use intent directly. Why is there such a combination of intent+bundle?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
世界只因有你

Even if you use intent to pass it, a bundle will be automatically generated.
So in fact, bundles are used

Peter_Zhu

The first floor has already answered it correctly, I just posted the source code:

    /**
     * Add extended data to the intent.  The name must include a package
     * prefix, for example the app com.android.contacts would use names
     * like "com.android.contacts.ShowAll".
     *
     * @param name The name of the extra data, with package prefix.
     * @param value The String data value.
     *
     * @return Returns the same Intent object, for chaining multiple calls
     * into a single statement.
     *
     * @see #putExtras
     * @see #removeExtra
     * @see #getStringExtra(String)
     */
    public Intent putExtra(String name, String value) {
        if (mExtras == null) {
            mExtras = new Bundle();
        }
        mExtras.putString(name, value);
        return this;
    }
给我你的怀抱

It seems that the bundle can transfer many data types?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!