Monday, August 2, 2010

[android-developers] Issue with populating a ViewFlipper child View with a ListView

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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment