vendredi 14 avril 2017

android design pattern issue : change background of button from class other than activity or view class

I am encountering design pattern issue in my android project. I wonder how to change background of button from class other than activity or view.

The structure of classes of my code is like this: an activity extends base activity base fragment - abstract class with 3 child fragment concrete classes a separate class that is not an activity or a view but contains a popup window field and methods controlling the behaviour of popup window

The sequence of click event is as follows: 1. Each concrete fragment class has different number of buttons. 2. When these buttons are clicked, a popup window with variable number of buttons show up. 3. When any one of the buttons of the popup window is clicked, a certain variable( based on which button of the popup window was being clicked ) that change the background of the button of the fragment which triggered the popup of window.

I am figuring out how to get the onclick event stuff works in the non-activity class containing the popup window. Any suggestion of solving my problem or better class design would be appreciated. Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire