Here is the parent class:
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();
}
}
Here is the child class:
private void ChildClass extends ParentClass () {
public ChildClass() {
SetScroll();
}
}
Forgive me with regards to the syntax as I'm typing this from memory. The problem with these classes is that the SetScroll
function called from the CallParent
function does not work because it is unable to find the right _listView
reference (it becomes null
). What should I do to make it work correctly? Bear in mind that this is just an example.