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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -