I'm trying to use broadcasters to send messages from a child thread to the main UI thread. So i have a broadcast receiver on my activities (i hate multiple) and i want to be able to send them messages from one single child thread (runnable).
Here is what i'm doing in the child thread:
Intent broadcastIntent = new Intent();
broadcastIntent.setAction(ResponseReceiver.ACTION_RESP);
broadcastIntent.putExtra("Controller", "connect");
context.sendBroadcast(broadcastIntent);
But the problem is how i define context? It gives the exception "context cannot be resolved" If i don't use it, it won't find "sendBroadcast" method. So how can this be done?