Back to project page miner.
The source code is released under:
Apache License
If you think the Android project miner listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.kolomiyets.miner.bt.notification; //from w w w .j av a 2 s. c o m import android.content.Context; import android.os.Handler; import com.kolomiyets.miner.Miner; public abstract class BtListener<T extends BtNotification> { public final Class<T> filter; private Handler handler = new Handler(); public BtListener(Class<T> filter) { this.filter = filter; } public void postNotification(final BtNotification notification){ if(filter.isInstance(notification)){ handler.post(new Runnable() { @Override public void run() { processNotification((T)notification); } }); } } public void register(Context context){ Miner app = (Miner)context.getApplicationContext(); app.getNotificationManager().registerListener(this); } public void unregister(Context context){ Miner app = (Miner)context.getApplicationContext(); app.getNotificationManager().unregisterListener(this); } public abstract void processNotification(T notification); }