You should be able to define your own constructor or setter that takes
the context as a parameter, no?  Does that not work?

MyPhoneStateListener(Context ctx)
{
     this.ctx = ctx;
}

or something -

sthustfo wrote:
> Hi,
>
> I would like to know how I can start a new activity from within the
> PhoneStateListener method, say onCallStateChanged(). I do understand
> that notifications must be used in general but since my test app deals
> with voice call, I was thinking of starting an activity.
>
> public class MyPhoneStateListener extends PhoneStateListener {
>       public void onCallStateChanged(int state, String incomingNumber)
>       {
>               //Context context = this;
>               Log.d("test", incomingNumber);
>
>               // context.startActivity(new Intent("com.test.DOSOMETHING"));
>               return;
>       }
> }
>
> The problem is that in order to send an intent, I do not have the
> 'context' available in the onCallStateChanged() method.
>
> In this case, how I can send an intent using startActivity?
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to