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

通过 Id 或 Tag 来识别 Fragment 不可靠 #2

Open
douo opened this issue Mar 5, 2018 · 0 comments
Open

通过 Id 或 Tag 来识别 Fragment 不可靠 #2

douo opened this issue Mar 5, 2018 · 0 comments
Assignees
Labels

Comments

@douo
Copy link
Owner

douo commented Mar 5, 2018

通过 Id 或 Tag 来识别 Fragment 不可靠:

id 或 tag 都是可以不唯一的,通过下面的代码将两个无 tag Fragment 添加到同一个 container 中,Fragment 都会使用其 container view id 作为 id

    OneButtonFragment fragment = OneButtonFragment.newInstance("captureFragmentWithTag");
    getFragmentManager().beginTransaction().add(R.id.parent, fragment, null).commit();
    fragment = OneButtonFragment.newInstance("captureFragmentWithTag2");
    getFragmentManager().beginTransaction().add(R.id.parent, fragment, null).commit();
2 = {OneButtonFragment@5739} "OneButtonFragment{21d279d #2 id=0x7f07004c}"
3 = {OneButtonFragment@5786} "OneButtonFragment{f2c505b #3 id=0x7f07004c}"
@douo douo self-assigned this Mar 5, 2018
@douo douo added the bug label Mar 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant