The android Fragments tutourial teaches how to send data from a fragment to activity in using Interfaces
. I don't understand interfaces that much and NOBODY gives a good example of how to use them not even docs.oracle.com. What I want to know is how to recreate something like LocationListener
, where I:
1) implement the interface in class A
2) set the handler for example :setInterfaceHandler(this)
in class A
3) add my implementation of the interface in class A foe Example:
public void onSomethingHappened(String s)
{
// do this
}
4) periodically have class B fire off events that will be caught by the handler class in A
For example: Android will periodically give my activity location updates (Dont know how to do this).