I did say what the error was: Application stopped unexpectedly. The code as above runs perfectly fine and I should note this code is based on Google's Notepad tutorial, except it only had one group. I had the same 1 group setup in my app, but the code (as represented in ListView/TextView group 2) kept failing with that generic error. So, I opened a working tutorial project and copied it over into my XML file (group 1). As soon as I did that, the app worked fine, spitting out two lines on-screen.
What I don't get is why, if you take out the first ListView/TextView group, then emulator bombs with that generic error. Eclipse provides no insight as to why. On Sep 29, 7:24 am, Mark Murphy <[EMAIL PROTECTED]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---

