Display content on a phone screen

  1. Import the required classes and interfaces.
    import net.rim.blackberry.api.phone.*;
    import net.rim.blackberry.api.phone.phonegui.*;
  2. Create a class that extends the AbstractPhoneListener class.
    class MyPhoneScreenAction extends AbstractPhoneListener
    {
    }
  3. Override PhoneListener.callIncoming() and PhoneListener.callWaiting(). For each method, add an instance of the PhoneScreen class, passing in the call ID and your application identifier.
    public void callIncoming(int callid)
    {
        PhoneScreen f = new PhoneScreen(callid, app);
    }
    public void callWaiting(int callid)
    {
        PhoneScreen f = new PhoneScreen(callid, app);
    }
  4. Invoke PhoneScreen.addImage() when the application detects a specified callid.
    f.addImage(_images[0]);
  5. Invoke PhoneScreen.sendDataToScreen() to display the content in the PhoneScreen object in the incoming and active phone screens.
    f.sendDataToScreen();
  6. In the MyPhoneScreenAction class, invoke Phone.addPhoneListener() to register the class that extends AbstractPhoneListener as a PhoneListener.
    Phone.addPhoneListener(new MyPhoneScreenAction(this));
Next topic: BlackBerry Browser

Was this information helpful? Send us your comments.