Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support use default value by set null as parameter #4

Closed
talenguyen opened this issue Feb 24, 2015 · 0 comments
Closed

Support use default value by set null as parameter #4

talenguyen opened this issue Feb 24, 2015 · 0 comments

Comments

@talenguyen
Copy link
Owner

There is no reason to set and get null value into the Bundle object.

So

null will not be set as an extra value. That mean, if you set null as the parameter then the target Activity/Fragment/Service will not get that value.

TargetActivity

@Extra String name;
@Extra int age;

@Override public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrettyBundle.inject(this); // call to inject the extra.
}

Set extras with null for the TargetActivity

Intent intent = Activities.createTargetActivityIntent(null, null);
startActivity(intent);

Then

TargetActivity.name //take class variable default value.
TargetActivity.age //take class variable default value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant