That was exactly the problem. Thanks a lot! --Valeriano
On Sat, Nov 22, 2008 at 10:10 PM, Mark Murphy <[EMAIL PROTECTED]>wrote: > > Allan Valeriano wrote: > > Hi, > > > > I'm trying to create a radio button group using the resources and > > recover it on my Activity code, but I'm receiving a NullPointerException > > when I do that. > > > > Here is my xml code: > > > > <?xml version="1.0" encoding="UTF-8"?> > > <LinearLayout xmlns:android=" > http://schemas.android.com/apk/res/android" > > android:orientation="vertical" android:layout_width="fill_parent" > > android:layout_height="fill_parent"> > > > > <LinearLayout android:orientation="vertical" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:layout_marginTop="10px"> > > > > <TextView android:layout_width="wrap_content" > > android:layout_height="wrap_content" android:text="Share > > this log:" /> > > <RadioGroup androidid="@+id/shareOptionGroup" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" > > xmlns:android=" > http://schemas.android.com/apk/res/android" > > android:orientation="horizontal"> > > > > <RadioButton androidid="@+id/realTimeButton" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" > > android:text="Real Time" android:checked="false" > > android:layout_gravity="left" > android:layout_weight="0"> > > </RadioButton> > > <RadioButton androidid="@+id/afterSaveButton" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" > > android:text="After Saving" android:checked="false" > > android:layout_gravity="left" > android:layout_weight="0"> > > </RadioButton> > > <RadioButton androidid="@+id/otherButton" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" > > android:text="Do not share" android:checked="false" > > android:layout_weight="0" > android:layout_gravity="left"> > > </RadioButton> > > </RadioGroup> > > > > </LinearLayout> > > </LinearLayout> > > > > > > > > And I recover it using: > > > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.config_xml); > > group = Groupthis.findViewById(R.id.shareOptionGroup); > > group.setOnCheckedChangeListener(this); > > } > > > > > > > > when I run it, I receive a NullPointerException on > > /group.setOnCheckedChangeListener(this)/; > > Does anybody knows whys is it happening? > > If the code you have pasted here is exactly what you have, your problem > may be: > > <RadioGroup androidid="@+id/shareOptionGroup" > > You are missing a colon between android and id. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com > > Android Training on the Ranch! -- Mar 16-20, 2009 > http://www.bignerdranch.com/schedule.shtml > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---