Hi all, is there possibility to create an id in a lower namespace? ...as id in file only
Il giorno sabato 30 agosto 2008 10:45:27 UTC+2, Romain Guy ha scritto: > > Hi, > > @+id/foo means you are creating an id named foo in the namespace of > your application. You can refer to it using @id/foo. @android:id/foo > means you are referring to an id defined in the android namespace. > This namespace is the namespace of the framework. In this case, you > need to use @android:id/list and @android:id/empty because these are > the id the framework expects to find (the framework knows only about > the ids in the android namespace.) > > The XML layout editor doesn't know how you will use your layout and > generates by default ids that are in your application namespace. So > the XML format is correct, it's not a compile time error, but really a > runtime error. > > On Fri, Aug 29, 2008 at 11:58 PM, etooler <[email protected]> wrote: > > > > Hi All, > > > > Just starting with this and noticed an interesting problem when doing > > the Notepad V1 tutorial... > > > > In step 4, it says to create an XML file that looks like this: > > > > <?xml version="1.0" encoding="utf-8"?> > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > > android" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content"> > > > > <ListView android:id="@android:id/list" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content"/> > > <TextView android:id="@android:id/empty" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" > > android:text="@string/no_notes"/> > > > > </LinearLayout> > > > > If I do this, everything works OK. > > > > However, I decided to use the Layout view tool in eclipse and use that > > to insert the ListView and TextView above. It instead uses > > android:id="@+id/list" and android:id="@+id/empty". When I go to run > > using this, I do not get any compile time warnings, however, my > > application throws up a "The application has stopped unexpectedly" > > error. > > > > My questions are: > > > > a.) What is the difference between the two formats? > > b.) Why does the Layout Viewer create XML in a format that does not > > work? > > c.) Should this type of error be picked up at compile time? > > > > Another point, when I open up the LunarLander sample project and open > > up the lunar_layout.xml file using the Layout viewer, I get an > > exception: NotfoundException: Could not find drawable resource > > matching value 0x7F020001 (resolved name: earthrise) in current > > configuration. The application does compile and deploy however. > > > > I am using version 0.7.1.v200808141910-98467 as reported from eclipse > > for the android tools. > > > > > > > > > > > -- > Romain Guy > www.curious-creature.org > > -- You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en

