0

I've recently started designing apps in Android Studio, and I've noticed that the same operations (for example, using a widget) can be completed by either going into the activityname_java file and creating the widget as a java object, or by going into the activity_activityname.xml and using the combination of drag-and-drop plus HTLM to make the widget.

My question is, how do these different methods work together(Java and HTML)? I don't see one file change when I edit the other one, so must I primarily rely on just one of them? Is there any way I can keep the other file updated as I edit one? Is there any advantage to using one type over the other? Any information would be greatly appreciated.

0

It's not HTML but XML you are referring to.

Android will create UIs for you if you define them in XML, which is much easier than doing it "by hand", (you have to hardwire and correctly initialise everything). You might need to go the "manual way" (code) if you have to dynamically create such UI from scratch, which is not usual for beginners (although even then, often you will be able to reuse XML resources).

Have a look at

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.