Hi there, I am trying to set up a ViewFlipper that changes a SlidingDrawers content each time a button is pressed. So far every view I set up worked fine, but now I am trying to create a ListView (including single_choice_mode) within a child view of the ViewFlipper, but my attempt only let to a NullPointerException. As I only discovered ViewFlipper today, I am not yet familiar with it and may not have understood it completely...if someone could give me a hand and help me find out what I have done wrong, that would be great.
Thank you in advance. Here is what I have done: The code for the onClick event of the ImageButtons: 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); } } The XML code of the ViewFlipper within my main xml file: <ViewFlipper android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/flipper" android:layout_toRightOf="@id/button_exposure"> <include android:id="@+id/view_exposure" layout="@layout/ exposureview" /> <include android:id="@+id/view_properties" layout="@layout/ propertiesview" /> <include android:id="@+id/view_special_effects" layout="@layout/ specialeffectsview"/> </ViewFlipper> The string array within my strings.xml: <string-array name="special_effects_array"> <item>None</item> <item>Greyscale</item> <item>Sepia</item> <item>Negative</item> <item>Solarize</item> <item>Polarize</item> </string-array> And finally the specialeffectsview.xml (the layout file for the ListView): <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/view_special_effects_list" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <ListView android:id="@+id/special_effects_list" android:layout_height="wrap_content" android:layout_width="fill_parent"></ListView> </LinearLayout> -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For more information about this change, please read [http://goo.gl/xkfl] or visit the Group home page. Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en