Giter Site home page Giter Site logo

Comments (7)

frankiesardo avatar frankiesardo commented on July 23, 2024

There's no such a thing as bundle.get intent() and bundle.putIntent() so I see no reason to support it with Icepick

from icepick.

yaming116 avatar yaming116 commented on July 23, 2024

not support last activity use intent send data

from icepick.

yaming116 avatar yaming116 commented on July 23, 2024
public static void restoreInstanceState(Activity activity, Bundle bundle){
        Intent intent = activity.getIntent();
        if(intent != null){
            //...
        }
        if(bundle != null){
            //...
        }
}

or user bundle send data

        //send data
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putBoolean("flag", true);
        bundle.putString("test", "test");
        intent.putExtras(bundle);
        activity.startActivity(intent);
        //get data
        Bundle bundle = getIntent().getExtras();
        Bundles.restoreInstanceState(this, bundle);

from icepick.

frankiesardo avatar frankiesardo commented on July 23, 2024

I see. But I don't think it would be something supported by Icepick. You don't usually send member variables inside the Intent so you can't leverage the power of annotations.

from icepick.

yaming116 avatar yaming116 commented on July 23, 2024

can support a api use generate Bundle value key, like this

    /**
     * 
     * @param clazz extends  Activity or Fragment or v4.Fragment
     * @param key
     * @return
     */
    public static String generateKey(Class<?> clazz, String key){
        //like this zj.UserConfigActivity.status
        return "generateKey";
    }
        //send data
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putBoolean(generateKey(Activity.class,"flag"), true);
        bundle.putString(generateKey(Activity.class,"test"), "test");
        intent.putExtras(bundle);
        activity.startActivity(intent);

from icepick.

frankiesardo avatar frankiesardo commented on July 23, 2024

Internally Icepick uses TypeElement instead of Class<?> for the key so I can't expose that public API. You'll be better off having that method in your own private utils.

from icepick.

yaming116 avatar yaming116 commented on July 23, 2024

You can provide key generated rules? I see that the now rules and the previous rules are not the same. Thank you

from icepick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.