-1

i am trying to add a custom window in blackberry but before this i am trying to add a custom label in that popup screen for my satisfaction that i can add or cant . so at the time when i am adding that i am facing the problem of IllegalArguementException error , so can you please tell me how can i solve that problem . i am doing like this .

see this is my MYScreen class which i am using to add pop-up . so pop-up is added when ever i clicked that press button , which is added in the Screen .

public final class MyScreen extends MainScreen implements FieldChangeListener
{
    private ButtonField btn;

public MyScreen()
    {        
        setTitle("MyTitle");

        btn = new ButtonField ("press");
        btn.setChangeListener(this);

        add(btn) ;
    }

public void fieldChanged(Field field, int context) 
{
    if ( field == btn )
    {       
    Dialog.inform("hello");

    pop_manager manager_object = new pop_manager(0);

    UiApplication.getUiApplication().pushScreen( new up_pop_test( manager_object ) );               
    }
}
}

so in this i have added , new_up_pop_test class which is :

public class up_pop_test extends PopupScreen
{
public up_pop_test( pop_manager delegate)
{
    super(delegate);

    add(delegate);
}
}

and pop_manager is :

public class pop_manager extends Manager
{
protected pop_manager(long style)
{
    super(style);
}

protected void sublayout(int w, int h) 
{
    Field f = getField(0);
    layoutChild( f , w/3+w/3 , 50 ) ;
    setPositionChild ( f , w/33 + w/33 , w/67+w/104 );

    setExtent(w,h);
}
} 
4

1 に答える 1

3

あなたがしようとしていたほど多くの仕事をする必要はありません...

必要なのは、通常の画面と同じように自由にカスタマイズできるPopupScreenだけです。

public class MyPopup extends PopupScreen  {

    public MyPopup() {
        super(new VerticalFieldManager());
        LabelField infoLabel = new LabelField("Here is a label in a popup");
        add(infoLabel);   
    }
}

呼び出すには、通常の画面のように押すだけです。

  UiApplication.getUiApplication().pushScreen(new MyPopup());  

Dialogクラスを制御することはできません。これらは、ユーザーへの通知や質問などの単純な操作用であり、標準化されています。

于 2013-01-02T17:53:09.840 に答える