What is the different between setContentView and getLayoutResource in android? -
generally, when want load android layout use setcontentview(view)
in oncreate function. saw function getlayoutresource()
load layout too. have read getlayoutresource, don't understand it.
different between them?
i not sure read getlayoutresource()
loading layout too? getlayoutresource()
method gets layout resource shown view. setcontentview(view)
on other hand sets activity content layout resource. resource inflated, adding top-level views activity.
so instance, if had invoked setcontentview(r.layout.my_awesome_layout);
, calling getlayoutresource()
should return integer identifier r.layout.my_awesome_layout
;
you can read more on setcontentview(android.view.view)
i hope helps.
Comments
Post a Comment