I am working on a layout of my main activity with Android Studio (the lowest API is 15) and have defined several XML buttons on it.
The idea of ββthe program is to edit the list of words by adding, displaying and clearing it using a set of buttons. (There is an EditText to add, but this is not important for the question). But with the idea of ββhigh cohesion, I defined this list and the methods that manipulate it in another class called WordList (which still extends the Activity), so when I try to call the onClick property of the button, it cannot find them.
android:onClick="addWord"
The 'addWord' method is missing from 'MainActivity' or has the wrong signature ...
Is there a way to make a layout or a single point of an element (or get its data context) from another class, or is this contrary to the whole structure of Android, and I should just put it in my original activity?
source
share