Results 1 to 5 of 5

Thread: Design XML

  1. #1
    Join Date
    Sep 2008

    Question Design XML

    Nelson says that designing layouts is tedious,
    it is XML what do you expect.

    What alternatives are there?
    Windows phone with XAML?
    Or something else like HTML5 if that is used for phones?
    Or just in general, what is better than xml.

  2. #2
    Join Date
    Mar 2004
    Anacortes, WA
    There are a lot of reasons why I say that working with layout files in Android are a bit of a pain; as sadly they are a bit... "clunky" to work with.

    There is a new databinding library that got released into BETA when Android M was announced that take a lot of the pain points that I have with the layout files; and it will be backwards compatible with older versions of Android. I'll be doing another (much smaller!) Android series that covers this and other newer Android features at a later time when the new stuff has stabilized a bit (Google says that breaking changes are expected at this point, and I don't want to do a series that will be outdated soon).

    As far as your question: "what is better than XML?" - well, XML itself isn't the problem. XML isn't really a "language" in and of itself per se, as it is intended to be extended to create other languages. For example, XHTML, XAML, BeerXML, SVG, etc, are all languages that are based on XML syntax. You specify what XML language you are working with by telling it which schema to use (the xmlns: part of the root element). Then you must take that XML file and feed it into some sort of interpreter/compiler that understands that specific language - in the case of Android development, that would be Android's resource compiler. In the case of XAML, that would be xamlc, which is part of the .net framework.

    You only have two choices when building layouts in Android: use layout resources (the XML files), or write Java code that manually instantiates and sets up every view and view group. Using the layout files, while tedious, is actually much preferable to doing it by hand in Java code: especially when the new databinding library comes out. You cannot use any other language, such as XAML or HTML to create views in Android.

    Well... You can, kinda, actually, use HTML. There are some libraries out there that either provide a special "web view" for your app, or convert HTML into corresponding Android views. They do this so you can write "cross-platform" applications. I am not a big fan of this, as I believe app development should be as close to the native APIs as possible for many reasons. I think Xamarin did it right by allowing a shared C# codebase, but still having each application be platform-specific; so that people can take advantage of more of the specific mobile operating system when they're writing their view code. In addition, each platform has very specific and unique design guidelines that should be addressed on a per-platform basis.

    Now, you certainly can instead write a web application that is optimized to mobile by taking advantage of responsive design (to see what I mean by that, go ahead and resize a browser window that's on That will of course be cross platform, as every modern mobile and desktop platform has very good modern HTML support. However, some things should be apps: such as messaging applications and whatnot. Since this course was all about app development, and not mobile web development, I didn't address any of that kind of stuff.

    Anyhow: does that make sense?
    Need any help? Feel free to PM me - or send an email directly to!

  3. #3
    Join Date
    Sep 2008
    Thanks for the reply. It kind of makes sense. The comment I refer to was made at the beginning of the Activity Life Cycle part 3 of the introduction to android so I guess you wouldn't necessarily remember it exactly.
    It did kind of sound like there may have been an alternative but I couldn't really see where.
    That is about where I am at with android stuff at the moment.
    My knowledge level is not that deep, but is in some ways. I was making things harder for myself by doing the Windows phone at the same time but even that has changes and I struggle to understand exactly what is going on. And also I was playing with WPF. I also had a look at Xamarin and confused myself a bit more.
    Hopefully as I plug away at the course things will become more clear. Databinding is not something I understand properly so will look forward to finding out more.
    A while ago I tried to write the Hyperion game in Java, just copying the relevant things, not actually knowing the Java. I got bits of it to work. Anyway as my knowledge isn't deep but it is there, and I look forward to learning more. A better memory would be good.
    I am about to install Windows 10 and Visual Studio 15 (again) and play with that. I was using that emulator but have mucked up my permissions on my drives so thing don't work properly now.
    Is there any sense to be made of the various Windows platforms, or is that a topic for another day.

    While I have you, did you see my question as to why not use Integer type instead of int, in Java. Is it too expensive?

  4. #4
    Join Date
    May 2014
    XML all the way if possible. Create custom views to handle view state changes and java to handle data changes.

  5. #5
    Join Date
    Jul 2015
    Thank you Nelson for such long anwer, I was just wondering what lgbon made u doubts about xml? Why are you searching for alternatives?

    In my opinion also xml , however good to know other possibilities.
    Convert your psd to html:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts