Interestingly, I still get a NullPointException after doing it the way
you seuggested... that brings me to my initial concern of incorrectly
referencing the layout.

On Nov 12, 7:47 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > At the moment I get a NullPointerException from my Activity when I do
> > the following:
>
> > RelativeLayout layout = (RelativeLayout) findViewById(R.layout.l1);
> > setContent(layout);
>
> > Is that a wrong way of obtaining a reference of my Layout?
>
> Try:
>
> setContentView(R.layout.l1);
>
> RelativeLayout
> container=(RelativeLayout)findViewById(R.id.whatever_you_use_for_id_in_the_XML_file);
>
> Most of the tutorials for Android will demonstrate getting Buttons or
> TextViews or whatever this way out of a loaded layout. Likewise,
> RelativeLayout is a widget, so you get a reference to it the same way.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
>
> Android Training on the Ranch! -- Mar 16-20, 
> 2009http://www.bignerdranch.com/schedule.shtml
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to