I have registered ProximityAlert in MapActivity. No problem with catching alerts in BroadcastReceiver and starting new Activity.
Beside starting new activity I want to notify MapActivity to clear overlay, proximity alert and stop count up timer.
Because broadcast receiver is in separate thread I was make a handler
public class MyHandler extends Handler {
private ProximityMapActivity MainActivity;
MyHandler(ProximityMapActivity a) {
this.MainActivity = a;
}...
in MapActivity
public void onCreate(Bundle savedInstanceState) {
handler = new MyHandler(this);
I have no problem with Handler from runOnFirstFix runnable I can start a count up timer.
But broadbast receiver is in separate class and I have no clue what to do
private MyHandler handler;
...
handler.sendEmptyMessage(11);
is give me null pointer exeption. When I add
handler= new MyHandler(new ProximityMapActivity());
Uncaught handler comes out.
Can you give me a hint or comment? Thank You in forward.
I forgot to add setter to my object. Now I can pass on the pointer of handler.
in MapActivity