• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Sending an intent from non-Activity extented class

I've two classes: MainActivity.java and CallReceiver.java . The problem is I can't send an intent from CallReceiver class. Eclipse throws an error: "The constructor error Intent(CallReceiver, Class<MainActivity>) is undefinied.

Code:
public class MainActivity extends Activity {
...
CallReceiver mCallReceiver = new CallReceiver(); 
// call my CallReceiver here
...
}

Code:
public class CallReceiver extends BroadcastReceiver  {
...
Intent intent = new Intent(CallReceiver.this, DisplayMessageActivity.class); 
// I'd like to send an intent from here to update MainAction.java view.
}
 
Back
Top Bottom