hi, newbie here. trying to add some radio buttons to a popup window (please see code below). the radio buttons work fine when added to the main layout. but when i add them to the popup window and attempt to display the popup, i don't see anything (not event the popup).

thanks

package tayek.radio;
import android.app.Activity;
import android.os.Bundle;
import android.view.*;
import android.view.View.OnClickListener;
import android.widget.*;
public class RadioActivity extends Activity {
LinearLayout linearLayout;
PopupWindow popupWindow;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addRadioButtonsToPopupWindow();
LinearLayout main=new LinearLayout(this);
Button button=new Button(this);
button.setText("Click Me");
main.addView(button);
OnClickListener onClickListener=new OnClickListener(){
public void onClick(View v) {
//popupWindow.dismiss();
popupWindow.showAsDropDown(v);
}
};
button.setOnClickListener(onClickListener);
setContentView(main);
}
private void addRadioButtonsToPopupWindow() {
linearLayout=new LinearLayout(this);
RadioGroup radioGroup=new RadioGroup(this);
linearLayout.addView(radioGroup);
RadioButton[] radioButtons=new RadioButton[3];
for(int i=0;i<radioButtons.length;i++) {
radioButtons[i]=new RadioButton(this);
radioButtons[i].setText("Choice "+(i+1));
radioGroup.addView(radioButtons[i]);
}
radioButtons[0].setChecked(true);
popupWindow=new PopupWindow(linearLayout);
}
}

---
co-chair http://ocjug.org/

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to