The error I find in my logcat when the Activity launches is:
E/AndroidRuntime( 296): java.lang.RuntimeException: Unable to start
activity Co mponentInfo{com.soft.tobi/com.soft.tobi.Game_main}:
java.lang.NullPointerExc eption

But I don't see why I would get a NullPointerExc eption because the
image ids are in my xml file

On May 6, 3:46 pm, Justin Anderson <[email protected]> wrote:
> Look at the LogCat output...  That will tell you the cause of the problem.
>
> Thanks,
> Justin Anderson
> MagouyaWare Developerhttp://sites.google.com/site/magouyaware
>
> On Thu, May 5, 2011 at 8:51 PM, Tom <[email protected]> wrote:
> > I am trying to set the size and position of an image (image2) on the
> > screen so that it is in the same position and size relative to the
> > background image (image1) it is on no matter the screen size. To do
> > this, I try to alter the layout parameters of image2 in my `onCreate`
> > method of my `Activity` class:
>
> >                RelativeLayout rl = (RelativeLayout)
> > findViewById(R.id.rlGen);
> >                RelativeLayout.LayoutParams params = new
> > RelativeLayout.LayoutParams(
> >                                (image1.getWidth()) / 4,
> > (image1.getHeight()) / 4);
> >                params.leftMargin = (image1.getWidth()) / 2;
> >                params.topMargin = (image1.getHeight()) / 2;
> >                rl.addView(image2, params);
>
> > But when my app goes to this activity, I get an error that says the
> > application has stopped unexpectedly. Then I have to force close the
> > app. Why would this happen? Is there something I am missing? or is
> > there a better way to do this?
>
> > --
> > 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

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