[android-beginners] NullPointerException using RadioGroup

2008-11-22 Thread Allan Valeriano
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?

--Valeriano

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-beginners] Re: NullPointerException using RadioGroup

2008-11-22 Thread Allan Valeriano
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
-~--~~~~--~~--~--~---



[android-beginners] Re: Drawing a path line

2008-11-12 Thread Allan Valeriano
Not really.
I just want to draw a straight line from point A to point B.

--Valeriano

On Wed, Nov 12, 2008 at 6:32 AM, Dennis Wilmsmann [EMAIL PROTECTED]
 wrote:


 Do you want to show driving directions? I think this isn't possible
 anymore without getting the information via HTTP vom Google Maps
 directly. The class com.google.googlenav.DrivingDirection isn't
 available anymore in the SDK 1.0.

 Dennis

 On 12 Nov., 01:47, Allan Valeriano [EMAIL PROTECTED] wrote:
  Hi all,
 
  I've been trying to draw a path line for a while, but had no success. I
  tried a dummy code just to see if it works, but couldn't make it draw
  anything.
 
  The code I'm using is:
 
Path path = new Path();
 
 Projection proj = mapView.getProjection();
 GeoPoint point1 = new GeoPoint(37423157, -122085008);
 GeoPoint point2 = new GeoPoint(37495999, -122457508);
 Point p1 = new Point();
 Point p2 = new Point();
 
 proj.toPixels(point1, p1);
 proj.toPixels(point2, p2);
 
 path.moveTo(p1.x, p1.y);
 path.lineTo(p2.x, p2.y);
 
 this.pathPaint.setStrokeWidth(4);
 this.pathPaint.setARGB(100, 113, 105, 252);
 canvas.drawPath(path, pathPaint);
 
  This code is inside my overridden *draw* method, which is called every
 time
  my location, on the map, changes. I found an example (
 http://www.anddev.org/google_driving_directions_-_mapview_overlayed-t...)
  on how to do this, but it uses an old API that is not available anymore.
  Anybody knows what am I doing wrong here?
 
  --Valeriano
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-beginners] Drawing a path line

2008-11-11 Thread Allan Valeriano
Hi all,

I've been trying to draw a path line for a while, but had no success. I
tried a dummy code just to see if it works, but couldn't make it draw
anything.

The code I'm using is:

  Path path = new Path();
   Projection proj = mapView.getProjection();
   GeoPoint point1 = new GeoPoint(37423157, -122085008);
   GeoPoint point2 = new GeoPoint(37495999, -122457508);
   Point p1 = new Point();
   Point p2 = new Point();

   proj.toPixels(point1, p1);
   proj.toPixels(point2, p2);

   path.moveTo(p1.x, p1.y);
   path.lineTo(p2.x, p2.y);

   this.pathPaint.setStrokeWidth(4);
   this.pathPaint.setARGB(100, 113, 105, 252);
   canvas.drawPath(path, pathPaint);


This code is inside my overridden *draw* method, which is called every time
my location, on the map, changes. I found an example (
http://www.anddev.org/google_driving_directions_-_mapview_overlayed-t826.html)
on how to do this, but it uses an old API that is not available anymore.
Anybody knows what am I doing wrong here?

--Valeriano

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---