XML stands for Extensible Markup Language. It is a markup language much like HTML but the the difference between XML and HTML is, XML was designed to transport and store data while HTML was designed to display data.XML is easy to parse and manipulate data pro-grammatically. It is a verbose(expressed in more words) and having a easily human readable format.
XML is easy to parse and manipulate programmatically, it's basically a tree structure and most UI creation tools already use it. It really has nothing to do with decoupling business logic because you can define Java code in Android using a Model-View-Controller pattern just as well.The reason that XML was chosen for android is because of its familiarity and the number of IDE (Integrated Development Environment like eclipse) tools that natively support it.
The auto-generated R.java file is a helper for the IDE so that you can get the benefit of autocomplete when you want to access a resource. It also stops you from making stupid mistakes since the compiler will complain if you try to access a resource you haven't defined. If you were using a simple properties file you wouldn't know until runtime that the 'key' you are using is missing.
There are several XML files used:
Layout XML:
-Used to define the actual UI (user interface) of your application.
-It holds all the elements or the tools that you want to use in your application.
Manifest XML:
-Used to define all the components of your application.
-It includes the names of your packages, your classes(Activities), services, permissions that your application needs.
String XML:
-Used to replace the hard coded strings with a single string.
-Like, you can replace "Welcome to my application" with a string named "welcome" and you can refer to that string.
Styles XML:
-Used to define different styles and looks for the UI of your application.
Drawable XML:
-Used to provide various graphics to the elements of your application.
Follow @amardeepvijay
XML is easy to parse and manipulate programmatically, it's basically a tree structure and most UI creation tools already use it. It really has nothing to do with decoupling business logic because you can define Java code in Android using a Model-View-Controller pattern just as well.The reason that XML was chosen for android is because of its familiarity and the number of IDE (Integrated Development Environment like eclipse) tools that natively support it.
The auto-generated R.java file is a helper for the IDE so that you can get the benefit of autocomplete when you want to access a resource. It also stops you from making stupid mistakes since the compiler will complain if you try to access a resource you haven't defined. If you were using a simple properties file you wouldn't know until runtime that the 'key' you are using is missing.
There are several XML files used:
Layout XML:
-Used to define the actual UI (user interface) of your application.
-It holds all the elements or the tools that you want to use in your application.
Manifest XML:
-Used to define all the components of your application.
-It includes the names of your packages, your classes(Activities), services, permissions that your application needs.
String XML:
-Used to replace the hard coded strings with a single string.
-Like, you can replace "Welcome to my application" with a string named "welcome" and you can refer to that string.
Styles XML:
-Used to define different styles and looks for the UI of your application.
Drawable XML:
-Used to provide various graphics to the elements of your application.
Read More !