2012-04-27 5 views
0

私はcreate a alert dialog with radiobuttonsを1つ選択するためにoralert dialog with Checkboxesをblackberry.itで複数選択することは可能です。しかし、blackberry.itでgoogleで検索します。任意の解決策を得ました。この問題に対する有用なリンクを提案してください。私たちは、ブラックベリーのラジオボタンとチェックボックスを使って警告ダイアログを作成できますか

答えて

4
import net.rim.device.api.system.Bitmap; 
import net.rim.device.api.ui.component.CheckboxField; 
import net.rim.device.api.ui.component.Dialog; 
import net.rim.device.api.ui.container.DialogFieldManager; 

public class CheckboxInputDialog extends Dialog{ 

    private CheckboxField checkboxEditField; 

    public CheckboxInputDialog(String choices[],int values[], String label){ 
    super(label, choices,values,Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.INFORMATION), Dialog.GLOBAL_STATUS); 

    checkboxEditField = new CheckboxField("Lablel",false); 
    net.rim.device.api.ui.Manager delegate = getDelegate(); 
    if(delegate instanceof DialogFieldManager){ 
     DialogFieldManager dfm = (DialogFieldManager)delegate; 
     net.rim.device.api.ui.Manager manager =dfm.getCustomManager(); 
     if(manager != null){ 
      manager.insert(checkboxEditField, 0); 
     } 
    } 

}  

} 

今の方法を以下では、このダイアログを呼び出し...

String choices[] = { "OK", "CANCEL" }; 
    int values[] = { Dialog.OK, Dialog.CANCEL }; 
    CheckboxInputDialog d = new CheckboxInputDialog(choices,values,"Dialog Label"); 
    d.show(); 

出力は次のようになります

enter image description here

はOKのイベントを取得し、[キャンセル]ボタン。完全なヘルプ

String choices[] = { "OK", "CANCEL" }; 
    int values[] = { Dialog.OK, Dialog.CANCEL }; 
    final CheckboxInputDialog d = new CheckboxInputDialog(choices, values,"Dialog Label"); 
    UiApplication.getUiApplication().invokeLater(new Runnable() { 
     public void run() { 
      int iResponse = d.doModal(); 
      if (iResponse == 0) { 
       System.out.println("Press Ok"); 
      }else{ 
       System.out.println("Press Cancel"); 
      } 
     } 
    }); 

・ホープ..

+0

感謝私はthis.iに関するいくつかの疑問を持って、私は – user1213202

+0

@ sandhya.M私は編集を持っていることを記述する必要がok.howボタンのいくつかのアクションを実行したいu.butあなたはアクションイベントを得ることができます。 –

0

popupScreenを作成し、この画面にラジオボタンとチェックボックスを追加できます。

public class Custom_Popup extends PopupScreen { 

public Custom_Popup() { 
    // TODO Auto-generated constructor stub 
    super(new VerticalFieldManager(Manager.VERTICAL_SCROLL), 
Field.NON_FOCUSABLE | Field.USE_ALL_WIDTH); 



} 

} 
0

この場合、この画面を押します。

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


public class MyPopup extends PopupScreen{ 
public MyPopup() { 
    super(new VerticalFieldManager(), Field.FOCUSABLE); 
    add();//add checkbox , radio buttons here. 
} 
関連する問題