title: In Android, how do you call a parent function with View references in it?
body: <p>Here is the parent class:</p>
  
  <pre><code>public class void ParentClass () extends Activity {
  
  private ListView _listView;
  
  @Override
  protected onCreate (Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_parent);
  
      _listView = (ListView) getViewById(R.id.list_view);
  
      ChildClass cc = new ChildClass();
  }
  
  protected void SetScroll() {
      try {
          _listView.setFastScrollEnabled(false);
  
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>Here is the child class:</p>
  
  <pre><code>private void ChildClass extends ParentClass () {
  
      public ChildClass() {
          SetScroll();
      }
  }
  </code></pre>
  
  <p>Forgive me with regards to the syntax as I'm typing this from memory. The problem with these classes is that the <code>SetScroll</code> function called from the <code>CallParent</code> function does not work because it is unable to find the right <code>_listView</code> reference (it becomes <code>null</code>). What should I do to make it work correctly? Bear in mind that this is just an example.</p>