I have written a inner class BroadcastReceiver in a Service. And I want to send another broadcast in onReceive() of BroadcastReceiver to an Activity.
My code is:
public static class ServiceBroadcastReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
// TODO Auto-generated method stub
Intent intent1 = new Intent("com.test.test");
sendBroadcast(intent1);
}
}
But Eclipse hints "Can't make a static reference to the non-static method sendBoradcast()"
The solution I thought is to dynamically register the broadcastreceiver and remove "static" before the class.
Is this the best way?