question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

validation on fragment is not working after back pressed

See original GitHub issue

I am using kotlin DSL for validation. I have multiple fragments opening after one another for user input. Each fragment has validation using code:

Sample code

private val validations by lazy {
	validationSet(
		validations = listOf(
			binding.txtSomething.isRequired(errorMessage = getString(R.string.field_required))
		),
		actions = actions
				validateByClickingOn binding.btnNext
				whenOnSuccess ::onValidationSuccess
	)
}

If I press the back button in between, validation stops working.

Observations:

  1. apply { validations } gets called once again once user comes back on fragment
  2. validateByClickingOn binding.btnNext whenOnSuccess ::onValidationSucces does not get called second time

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ParitoshVaidyacommented, Oct 29, 2019

Your update fixed the issue 👍

1reaction
wellingtoncostacommented, Oct 28, 2019

Hi @ParitoshVaidya

After a lot of problems with my environment, I published the 3.2.0-SNAPSHOT update.

Please try again and let me know.

I hope it works. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Back button not working in fragments - Stack Overflow
Whenever I use this code, I can't go back to previous page on back press on other fragments, it just works in the...
Read more >
Communicating with fragments - Android Developers
To keep fragments self-contained, you should not have fragments communicate directly with other fragments or with its host activity.
Read more >
Implement Form Validation (Error to EditText) in Android
When user data is corrected by the user -> // There is no need to give the error message when the user //...
Read more >
Building dynamic user interfaces in Android with fragments
The fragment instance is associated with an activity instance.The fragment and the activity is not fully initialized. Typically you get in this method...
Read more >
Camera preview disappears after Fragment onPause ...
Relnote: "Fix PreviewView black screen issues when swiped out Preview fragment and then swiped back in ViewPager2. Also fixed the issue when
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found