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

java.lang.IllegalStateException: Fragment already added #20

Closed
siddharth96 opened this issue May 12, 2015 · 5 comments
Closed

java.lang.IllegalStateException: Fragment already added #20

siddharth96 opened this issue May 12, 2015 · 5 comments

Comments

@siddharth96
Copy link

Hi,

I got this error when I tapped the 5th tab as soon as the UI rendered:

E/AndroidRuntime(28502): java.lang.IllegalStateException: Fragment already added: GenericProductListFragment{3147a7ad #2 id=0x7f0d026f}
E/AndroidRuntime(28502):    at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1209)
E/AndroidRuntime(28502):    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:674)
E/AndroidRuntime(28502):    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
E/AndroidRuntime(28502):    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:490)
E/AndroidRuntime(28502):    at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
E/AndroidRuntime(28502):    at android.support.v4.view.ViewPager.populate(ViewPager.java:1072)
E/AndroidRuntime(28502):    at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:554)
E/AndroidRuntime(28502):    at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:513)
E/AndroidRuntime(28502):    at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:494)
E/AndroidRuntime(28502):    at com.ogaclejapan.smarttablayout.SmartTabLayout$TabClickListener.onClick(SmartTabLayout.java:474)
E/AndroidRuntime(28502):    at android.view.View.performClick(View.java:4780)
E/AndroidRuntime(28502):    at android.view.View$PerformClick.run(View.java:19866)
E/AndroidRuntime(28502):    at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(28502):    at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(28502):    at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(28502):    at android.app.ActivityThread.main(ActivityThread.java:5254)
E/AndroidRuntime(28502):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(28502):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(28502):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/AndroidRuntime(28502):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Thanks,
Siddharth

@ogaclejapan
Copy link
Owner

Hi, @siddharth96

That you can not understand that you are using how this library from the error log,
Can you show me all of the parts of the code that sets up the FragmentManager?

@siddharth96
Copy link
Author

Hi,

I don't think it's something wrong with your library. I'd overrident the getItem() implementation while extending PagerAdapter, and my implementation was causing this. Fixed my code, and this issue also went away.
I'll close this issue.

Thanks for this awesome library.
Cheers!

@ogaclejapan
Copy link
Owner

👍

@AhmadullahSaikat
Copy link

AhmadullahSaikat commented Apr 27, 2019

👍 91

@nehagarg702
Copy link

can ypu tell. How you fixed this issue?

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

4 participants