I have an app structure like this:
Background:
The Parent activity #1 is just holding the tab host, tab widget and is also setting up the 3 tabs to have their content set to the 3 tab activities
(tab1, tab2, tab3 activities).
Update: I tried calling my validation method inside onTabChangedListener in Parent Activity #1 but I got a Null Pointer Exception. Couldn't really trace it to anywhere. I did commented/deleted conflicting code but still I am not getting the bottleneck.StackTrace(PasteBin Link). Code for Parent Activity #1,Tab#1 Activity
Problem:
I want to validate data entered by user in the form field(s) in the individual tab activities onTabChanged event but I am unable to set more than a single setOnTabChangedListener
.
Am I missing something here?
The listener(s) are set in their own tab# activities under oncreate
method.
Apart from trying the above technique, I had tried setting up the listener in onResume()
under the main Parent activity #1. But the on Resume()
method was never invoked. I got a null pointer exception too.
Idea behind validation being: I want that while the user is changing tabs, the data should be validated before he can skip over a tab. So, ineffect I would require tab#1 to validate data in a event similar to onTabChanged
if tab#2/tab#3 is selected.
Also, this would apply if current tab#2 is selected and user selects tab#1/tab#3
Any advice will be appreciated..
Thanks for reading..