Hi,
I am creating the object of the radiobutton but i am getting
nullpointer exception And also tell me how to use RadioGroup .
here is my code
public class RadioItem extends LinearLayout
{
private RadioGroup mradioGroup;
private RadioButton[] m_radiobutton ;
public RadioItem (Context context)
{
super(context);
}
public RadioItem(Context context,String title[])
{
super(context);
setOrientation(HORIZONTAL);
LinearLayout.LayoutParams layoutParams = new
LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(1,1, 1,1);
mradioGroup = new RadioGroup(context);
for(int i = 0 ; i < title.length ; i++ )
{
m_radiobutton[i] = new RadioButton(context); // here i
am getting
null pointer exception.
m_radiobutton[i].setText(title[i]);
this.addView(m_radiobutton[i],layoutParams);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---