Here's the code that I used, in case anyone else runs into this:
public class CallStateListener extends PhoneStateListener {
// Add context as a member variable
Context context = null;
@Override
public void onCallStateChanged(int state, String incomingNumber)
{
// Code here to process what happens when the change occurs, as well
as building an intent
...
context.startActivity(intent);
}
// Added a one-arg constructor, which invokes the parent's
constructor, then saves the context for later use.
public CallStateListener(Context ctx){
super();
context = ctx;
}
}
Then, inside of my service, I added this:
Context ctx = getBaseContext();
// Replaced: CallStateListener myCallStateListener = new
CallStateListener();
CallStateListener mCallStateListener = new CallStateListener
(ctx);
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment