title: How to validate input data in a Tab on Tab Change?
body: <p><br> I have an app structure like this: <br><img src="https://i.stack.imgur.com/SMzCX.png" alt="App Structure">
  <br><b>Background: </b><br>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 <code>activities</code> (tab1, tab2, tab3 activities).<br>
  
  <blockquote>
    <p><b><em>Update:</em> </b> 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.<a href="http://pastebin.com/Yz1nL07V" rel="nofollow noreferrer">StackTrace</a>(PasteBin Link).
    Code for <a href="http://pastebin.com/ZQujnYg6" rel="nofollow noreferrer">Parent Activity #1</a>,<a href="http://pastebin.com/e4DGhAq3" rel="nofollow noreferrer">Tab#1
    Activity</a></p>
  </blockquote>
  
  <p><br><br>
  <b>Problem: </b><br> I want to validate data entered by user in the form field(s) in the individual tab activities onTabChanged event <b>but</b> I am unable to set more than a single <code>setOnTabChangedListener</code>. <br> Am I missing something here?<br> The listener(s) are set in their own tab# activities under <code>oncreate</code> method.<br><br> Apart from trying the above technique, I had tried setting up the listener in <code>onResume()</code> under the main Parent activity #1. But the <code>on Resume()</code> method was never invoked. I got a null pointer exception too.</p>
  
  <p><b>Idea behind validation being:</b> 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 <code>onTabChanged</code> if tab#2/tab#3 is selected.<br> Also, this would apply if current tab#2 is selected and user selects tab#1/tab#3  </p>
  
  <p>Any advice will be appreciated..<br>Thanks for reading..</p>