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

refactor(navigation): Remove the need for using findViewById to obtai… #46

Merged
merged 2 commits into from
Jan 22, 2024

Conversation

bojankseneman
Copy link
Contributor

Remove the need to use findViewById

@@ -51,14 +51,18 @@ abstract class FragmentScreen<K>(
val activity = LocalContext.current.requireActivity() as FragmentActivity

val fragmentViewId = rememberSaveable { Random.nextInt(MAX_VIEW_ID) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we now also remove this variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should stay, otherwise the fragment won't save it's state. Android only saves the state of view's that have ids on them, if they don't then Android won't ask it to persist any state

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.

@matejdro matejdro merged commit 355c334 into master Jan 22, 2024
2 checks passed
@matejdro matejdro deleted the java_17 branch January 22, 2024 11:46
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

Successfully merging this pull request may close these issues.

2 participants