mferrell wrote: > I'd love someone to clue me in to some common pitfalls to designing > the UI through the XML because I'm clearly not understanding what's > going on with the code below. > > Run this below as your UI XML and it runs fine. Take out the first > ListView/TextView group, run it and you get an Application stopped > unexpectedly error. There are no significant differences that I can > see between the two. > > I'm new to both Java and Eclipse so maybe I'm missing something simple > here, I don't know. I'd appreciate any help. > > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:orientation="vertical" > android:layout_width="wrap_content" > android:layout_height="wrap_content"> > > <ListView android:id="@+id/android:list" > android:layout_width="wrap_content" > android:layout_height="wrap_content"/> > <TextView android:id="@+id/android:empty" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="Group 1"/> > <ListView android="@+id/android:list" > android:layout_width="wrap_content" > android:layout_height="wrap_content"/> > <TextView android:id="@+id/android:empty" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:text="Group 2"/> > </LinearLayout>
You didn't say what the error was, or provide any of your onCreate() source code. So, I can only comment on what I see unusual in this layout. If you wish to use the magic identifier for use with ListActivity, that is "@android:id/list" and can only appear once, whereas you are trying to use it twice. Likewise, if you want the magic identifier for what to display for an empty list, it is "@android:id/empty", and it should only appear once. If you really do want two ListViews in here, then: -- You'll need them to have distinct identifiers, probably of the form "@+id/list1" and "@+id/list2" -- I'm not sure the "@android:id/empty" trick will work -- you might need to implement that yourself via a ViewFlipper or making the ListView invisible or something -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.3 Published! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" 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-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

