Hi All,

I realize that this question of mine has already been asked before (probably 
not in the same context but similar). However, even after reading a number 
of forum threads and looking at online examples, I am still not clear. I 
hope one of you can guide me.

Here is the issue that I am facing. I have an activity which has a button. 
This button needs to be enabled/disabled depending on an external condition. 
We have a 3rd party library which has an observer class.

So basically in my android application, I have created a new class which 
extends this 3rd party observer class. Code snippet as follow:

class myObserver extends third.party.observer
{
    @Override
    public void onConnect()
    {
        // when this function is called I wish to enable the button on my 
UI.
    }

    @Override
    public void onDisconnect()
    {
        // when this function is called I wish to disable the button on my 
UI.
    }
} 

In my activity class, I create a new myObserver object and register it for 
events from our third party library as follow:
public class myActivity extends Activity
{
    private static myObserver tester = new myObserver()

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        ....
        ....
        third_party_registerObserverFunction(tester)
    }
}

My question is how can use myObserver class to update the button in 
'myActivity'.
The function 'onConnect' and 'onDisconnect' can be called at any time and I 
don't wish to implement polling (or timer) to check for variable status.

Please advice.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to