I'm trying to create a live template for Fragment's onCreateView()
. This is my template now:
After using it, R
wants to be manually imported.
How can I import application's R
by default? Or can I somehow get the project package name with a groovy script and write it before R
like $PACKAGE_NAME$.R.layout.$LAYOUT_NAME$
to make it work?
Enabling the "Add unambiguous imports on the fly" in File -> Settings -> Editor -> General -> Auto Import -> Java might solve your issue since it will automatically import the R class on the fly, and the need to manually import it will disappear.