I want to Pop up an new View on Top when a call is received and is in Ringing Mode..But i am unable To Do this. I am posting my code but also consider the code in comment.
package com.android.CallIntent;
import android.content.Context;
import android.content.Intent;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
public class Listener extends PhoneStateListener {
Context Context;
public Listener(Context context)
{
this.Context = context;
}
@Override
public void onCallStateChanged(int state, String incomingNumber) {
// TODO Auto-generated method stub
super.onCallStateChanged(state, incomingNumber);
switch(state)
{
case TelephonyManager.CALL_STATE_OFFHOOK:
break;
case TelephonyManager.CALL_STATE_RINGING:
Log.d("message","Ringing");
Intent intent = new Intent(Context, CallOptions.class);
// I want to start my new Activity From here please Help me.
//I am unable to access StartActivity
break;
}
}
}
// My BroadcastReceiver class is here
public class Receiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
Listener phoneStateListener= new Listener();
manager.listen(phoneStateListener, Listener.LISTEN_CALL_STATE);
}
Please someone help me out please please please.
Thanks in Advance.
Look here.... It must help you ...