java - Understanding method in Activity -
public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } }
this beginner question cant seem understand ,also searched , couldn't find same question.
here understand:
class mainactivity
extending appcompatactivity
can use fields , methods of parent class.
the protected void oncreate(bundle savedinstancestate) {
method inside parent class , getting overridden.then super
keyword used call oncreate(..)
method.
now dont understand setcontentview(..)
method. thought in java should use obj.method
or super.method
or classname.method
(if static) call method. here method used alone. need small explanation or redirection right place.
thank you.
setcontentview method inherits when extends activity class set activity content layout resource. resource inflated, adding top-level views activity. activity uses setcontentview(r.layout.main) set xml layout activity render ui of activity.
Comments
Post a Comment