RVG
RVG

Reputation: 3576

Dialog box background color on Blackberry

In my application, I show alert if the GPS location invalid:

Dialog.alert("Current Location info not available..");

I want to change the default background color and text color of the dialog alert. I need transparent silver color. How to create a custom dialog alert on Blackberry?

Upvotes: 0

Views: 969

Answers (1)

koti
koti

Reputation: 3721

To show custom dialog you need to create custom class by extending PopupScreen.

Like below.

class CustomPopUp extends PopupScreen
{

    public CustomPopUp(Manager delegate)
    {
        super(delegate);
    }
}

After creating custom class you need to take Manager like.

 VerticalFieldManager pop=new VerticalFieldManager();
 pop.setBackground(BackgroundFactory.createSolidBackground(Color.BLUE));
 LabelField lf=new LabelField("Invalid Location");
 ButtonField btn=new ButtonField("OK",DrawStyle.HCENTER);
 pop.add(lf);
 pop.add(btn);

Push Screen when you want to display dialog like below.

UiApplication.getUiApplication().pushScreen(pop);

On Button Click listener call

 UiApplication.getUiApplication().popScreen(pop);

Hope This will help you

Upvotes: 4

Related Questions