Android how to call layout events in other class? [closed]
I have main.xml
, mainActivity.java
class file and Book.java
class file, I want to use button click event (which is from main.xml
) in Book
class file. How can I do this?
Well i'm a little short on info here. But it seems you have to copy/paste the code in your onClickListener and put it inside you Book class buttons onClickListener. Another solution which i dont think is a great solution is that you put your action in a public static method, this way you'll be able to acces it from your Book class. If this doesn't make sense, please post your code and xml files. And elaborate your question.
精彩评论