2016-03-27 12 views
0

が表示されない:RS232 Javaのアンドロイド - ラジオボタンは、私は2つのラジオボタンを作成している

ために、Bluetoothの

  • 秒間

    • まず、しかし、私のアプリケーションは、それらの一つだけを示しています。

      これは私のコードです:

      final RadioButton Bluetooth = new RadioButton(this); 
      Bluetooth.setId(TEXT_ID); 
      alertDialogBuilder.setView(Bluetooth); 
      Bluetooth.setText("Bluetooth"); 
      Bluetooth.setTextSize(20); 
      
      final RadioButton RS232 = new RadioButton(this); 
      RS232.setId(TEXT_ID); 
      alertDialogBuilder.setView(RS232); 
      RS232.setText("RS232"); 
      RS232.setTextSize(20); 
      
  • +0

    レイアウトxmlも共有してください! – KostasC

    +0

    申し訳ありませんが、私はXMLを持っていません。目的は、2つのRadioButtonを警告ダイアログに追加することです。ユーザーがアイテムメニューをクリックすると、alertdialogが表示されます。 – McNavy

    答えて

    0

    は、あなたの警告ダイアログを定義するには、このコードを使用します。 2つのラジオボタンを含むxmlレイアウトを作成してから、Javaでアラートダイアログでviewとinflathatビューを作成します。

       View view2 = View.inflate(MyActivity.this, R.layout.radiobutton, null); 
    
           AlertDialog.Builder builderconversion = new AlertDialog.Builder(MyActivity.this); 
           //builder1.setMessage("Radio Message"); 
           builderconversion.setView(view2); 
           builderconversion.setCancelable(true); 
           builderconversion.setPositiveButton("CLOSE", 
             new DialogInterface.OnClickListener() { 
              public void onClick(DialogInterface dialog, int id) { 
    
               //Methods and functions 
               dialog.cancel(); 
              } 
             }); 
    
           AlertDialog alertconversion = builderconversion.create(); 
           alertconversion.show(); 
    
    +1

    ご協力いただきありがとうございます。レイアウトディレクトリに新しいXMLファイルを作成します。それが仕事なら、私は見ていきます。 – McNavy

    関連する問題