If your error report is accurate, you are not setting lv to a value, and so it is null.
On Mon, Aug 2, 2010 at 4:25 PM, kivy <victoriasarabu...@gmail.com> wrote: > Hi > > I am trying to populate a ViewFlipper with a ListView when a certain > button is clicked...but I only get a NullPointerException for > lv.setAdapter(new ArrayAdapter<String>(this, > R.layout.specialeffectsview, specialEffects)); > > To be honest I don't really know how to do this, I just learned about > the ViewFlipper today and I haven't fully understood how to use it > yet. If anyone could help me find how what I have done wrong, that > would be great. > > Thanks in advance. > > Here is the code I use: > > public void onClick(View v){ > if (v == btnExposure){ > > mFlipper.setDisplayedChild(0); > > } > else if (v == btnProperties){ > mFlipper.setDisplayedChild(1); > } > > else if (v == btnSpecialEffects){ > mFlipper.setDisplayedChild(2); > String[] specialEffects = > getResources().getStringArray(R.array.special_effects_array); > lv.setAdapter(new ArrayAdapter<String>(this, > R.layout.specialeffectsview, specialEffects)); > lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); > } > > } > > -- > 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 > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.9 Available! -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en