Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Second time using wizard fragment I get a NPE #95

Open
donhill opened this issue Jun 19, 2016 · 0 comments
Open

Second time using wizard fragment I get a NPE #95

donhill opened this issue Jun 19, 2016 · 0 comments

Comments

@donhill
Copy link

donhill commented Jun 19, 2016

I am calling the wizard fragment from my one activity. Currently I only use one Activity for all views using the following
getSupportFragmentManager().beginTransaction() .replace(R.id.nav_container, new RegistrationWizard()) .commit();

This works fine the first time but if I call the wizard a second time it loads fine but on the click to next I get the following error. I did notice that on the sample you there was a call to finish(). I can't really do this as my app would be over. It looks like on the second call that getActivity() returns null.

Any thoughts on how to properly get this working or do I need todo something differant on the finish, I am currently just calling the following in onWizardComplete() .

getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.support.v4.app.FragmentActivity.getSystemService(java.lang.String)' on a null object reference at org.codepond.wizardroid.WizardFragment.onStepChanged(WizardFragment.java:53) at org.codepond.wizardroid.layouts.BasicWizardLayout.onStepChanged(BasicWizardLayout.java:102) at org.codepond.wizardroid.Wizard$2.onPageScrollStateChanged(Wizard.java:117) at android.support.v4.view.ViewPager.dispatchOnScrollStateChanged(ViewPager.java:1873) at android.support.v4.view.ViewPager.setScrollState(ViewPager.java:460) at android.support.v4.view.ViewPager.smoothScrollTo(ViewPager.java:914) at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:623) at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:609) at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:570) at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:551)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant