Try moving your call to setContentView before the call to findViewById. If
you don't have layout, findViewById won't find a view. I'm assuming your
NPE is on that spinner.setAdapter(...) line.

On Mon, Feb 6, 2012 at 22:30, Ozone Apps <[email protected]> wrote:

> Sorry for being so vague the first time.  I was in a rush!  Heres the
> code thats causing the error:
>
> CODE
>
> String[] spinnerArray =
> getResources().getStringArray(R.array.a_chords);
>                  Spinner spinner = new Spinner(this);
>                    ArrayAdapter<String> spinnerArrayAdapter = new
> ArrayAdapter<String>(
>                            this, android.R.layout.simple_spinner_item,
> spinnerArray);
>
> spinnerArrayAdapter.setDropDownViewResource(
> android.R.layout.simple_spinner_dropdown_item );
>
>
>                    spinner = (Spinner) findViewById( R.id.choose_key);
>                    spinner.setAdapter(spinnerArrayAdapter);
>                    setContentView(R.layout.main);
>
> CODE
>
> The array I'm getting from the resources is here:
>
> <string-array name="a_chords">
>        <item >A</item>
>        <item >Bm</item>
>        <item >C#m</item>
>        <item >D</item>
>        <item >E</item>
>        <item >F#m</item>
>        <item >E7th</item>
>    </string-array>
>
> Heres the logcat:
>
> java.lang.NullPointerException
>
> any ideas?
>
>
>
> On Feb 6, 12:04 pm, TreKing <[email protected]> wrote:
> > On Sat, Feb 4, 2012 at 2:57 PM, Ozone Apps <[email protected]
> >wrote:
> >
> > > Any ideas?
> >
> > Debug your app.
> > Explain "throwing a Serouce Not Found error".
> > Post a logcat.
> > Show some code.
> >
> >
> ---------------------------------------------------------------------------
> ----------------------
> > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > transit tracking app for Android-powered devices
>
> --
> 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