Reputation: 794
I am starting with development in android apoplications, but not sure about the creation of views. Which one of the two is more preferable in terms of memory-consumption for creation of views : XML or Java Class ?
Can you please suggest which approach is more memory-friendly either XML or Java classes for creation of view ?
Upvotes: 1
Views: 119
Reputation: 37729
There is ultimately Java behind the xml..
so both are same as creating from Java or using xml.
XML help us to customize Views
quickly and drag & drop graphically.
The Layout tricks actually works. (For example: Here is an illustration to optimize the memory consumption.)
Upvotes: 1
Reputation: 1641
For the purpose of memory-consumption XML Views are best to use but if you want to make your View Dynamic as you receive data from the Server or from any other resource at run time Then you can use Java for creating those Views.
Upvotes: 0
Reputation: 265
If you are just starting with the development and you are new to android..go with XML its easier to understand and experiment with.there are a lot of tutorials around.
Java classes are usually used to set view dynamically..so i would suggest start with XML and move to simple Java tutorials. with memory friendly part(i dint get what you are trying to say) if its about the load time or the CPU usage.its non the less same.
Upvotes: 0