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

Not working on fragments #101

Open
jelther opened this issue May 10, 2017 · 1 comment
Open

Not working on fragments #101

jelther opened this issue May 10, 2017 · 1 comment

Comments

@jelther
Copy link

jelther commented May 10, 2017

The docs are saying this library is compatible with Fragments but I can't make it work on my project.

I'm simply defining my variable as :

@State String test;

After doing so, inside the methods "onSaveInstance" and "onCreateView" I'm saving/restoring using the methods provided by "IcePick" class.

To take out the doubt, I've manually defined at my Bundle the variable and it has worked like a charm.

Is there something missing?

@or-dvir
Copy link

or-dvir commented Apr 4, 2018

I have the same problem.

i have this code inside BaseFragment

@Override
public void onSaveInstanceState(Bundle outState)
{
	Icepick.saveInstanceState(this, outState);
	super.onSaveInstanceState(outState);
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
	Icepick.restoreInstanceState(this, savedInstanceState);
	return null;
}

and a fragment which extends BaseFragment and calls super.onCreateView(inflater, container, savedInstanceState); inside the method onCreateView and my string is not saved

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

2 participants