2011-10-24 147 views

回答

1

您可以使用PhoneListener接口,然后重写相同的方法。

public class CatchCall extends Application implements PhoneListener { 

    boolean yes = false; 
    int st; 

    public CatchCall() { 
     Phone.addPhoneListener(this); 
    } 

    public static void main(String[] args) { 
     new CatchCall().enterEventDispatcher(); 
    } 

    public void callAdded(int callId) { 
    } 

    public void callAnswered(int callId) { 
    } 

    public void callConferenceCallEstablished(int callId) { 
    } 

    public void callConnected(int callId) { 

     // TODO Auto-generated method s 
     PhoneCall phoneCall = Phone.getCall(callId); 
     if (phoneCall != null) {    
       //TODO: push your screen here 
       Dialog.ask(Dialog.D_YES_NO, "Push my screen here"); 
     } 
    } 

    public void callDirectConnectConnected(int callId) { 
    } 

    public void callDirectConnectDisconnected(int callId) { 
    } 

    public void callDisconnected(int callId) { 

    } 

    public void callEndedByUser(int callId) { 
    } 

    public void callFailed(int callId, int reason) { 
    } 

    public void callHeld(int callId) { 
    } 

    public void callIncoming(int callId) { 
       //TODO: push your screen here 
     Dialog.ask(Dialog.D_YES_NO, "Push my screen here"); 

    } 

    public void callInitiated(int callid) { 

     PhoneCall phoneCall = Phone.getCall(callid); 
     if (phoneCall != null) { 
       //TODO: push your screen here 
      Dialog.ask(Dialog.D_YES_NO, "Push my screen here"); 
     } 

    } 

    public void callRemoved(int callId) { 
    } 

    public void callResumed(int callId) { 
    } 

    public void callWaiting(int callid) { 
    } 

    public void conferenceCallDisconnected(int callId) { 
    } 
} 
+0

我是否需要在三个回调方法中推送我的屏幕......仅仅在callIncoming()方法上推送它是不够的。 –

+0

你可以在原始问题中解释这些事情吗?这会帮助我们帮助你。 –