> Also, Roman Guy replied in another thread, that you can't do the same > with Java as you can with XML (although that seems odd, all other XML > view technologies I know of ultimately translates into a Java > component tree): > http://groups.google.com/group/android-beginners/browse_thread/thread/5f130bfbc51669aa
You can do the same, but with XML the system will automatically select the appropriate layout based on the device's configuration. You could do it by hand if you really wanted but have fun with that. There is really very little point in building the UI from Java code except complicating the source code and making some things harder (like supporting configurations.) > > /Casper > > On 7 Aug., 23:25, "Yusuf T. Mobile" <[email protected]> wrote: >> If your question is "why even use XML to layout UI?" the answer is >> "because some people like it better; they find it easier and cleaner; >> other's prefer to do it in Java". As Teal said, you don't have to use >> XML if you don't like. I at first found the XML layout method foreign, >> and the plethora of approaches daunting. I would have benefitted from >> a tutorial that first focused on only Java and then broadened to XML, >> but I survived and now find XML UI layout to be useful, sometimes. >> >> Yusuf Saib >> Android >> ·T· · ·Mobile· stick together >> The views, opinions and statements in this email are those of the >> author solely in their individual capacity, and do not necessarily >> represent those of T-Mobile USA, Inc. >> >> On Aug 6, 4:25 pm, Teal <[email protected]> wrote: >> >> > You can construct the UI programatically without using XML. Follow >> > the Hello World tutorial (http://developer.android.com/guide/tutorials/ >> > hello-world.html), and note how the UI is constructed in "Construct >> > the UI" section, and notice how it is alternatively implemented using >> > XML in the "Upgrade the UI to an XML Layout" section. >> >> > On Aug 6, 12:29 pm, Casper Bang <[email protected]> wrote: >> >> > > My original first post doesn't seem to get approved, so let me try >> > > again. :) >> >> > > I'm wondering whether other Android newbies than me find the empathy >> > > on XML layout troublesome? I realize we should strive to separate view >> > > from logic and that XML is hip and trendy, but is it really necessary >> > > for these relatively simple Android applications? >> >> > > XML layouts involves more files and what feels like a lot of >> > > "magic" (type unsafe) properties, and makes samples harder to follow/ >> > > type. It also can't be especially efficient to use findViewById >> > > (whether BFS or DFS based) constantly? >> >> > > It sort of reminds me of the differences between JSF and Wicket, where >> > > the former was designed by people sitting in an ivory tower while the >> > > latter was designed for and by people at the ground, comfortable with >> > > Java. Which also leads me to wonder how come Android uses the old type- >> > > unsafe int enum pattern and also, why fluent-interfaces/method- >> > > chaining isn't used in greater extend? >> >> > > /Casper >> >> > > PS: You might want to fix the URL's to the group charter and FAQ as >> > > they currently go into 404. > > > -- Romain Guy Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

