https://kotlinlang.org logo
#android
Title
# android
p

Priyankkumar Patel

10/10/2019, 5:53 PM
is there any option in Android Studio from which, we can customize the default imports ,so we don't have to add the kotlin synthetic library again and again in every activity file.
m

Mark Murphy

10/10/2019, 6:03 PM
If by "default imports", you mean you want the Kotlin synthetic properties to be on par with
String
and not require an
import
, Android Studio has nothing to do with it. The
import
rules are from the Kotlin compiler.
p

Priyankkumar Patel

10/10/2019, 6:04 PM
No, I didn't mean it.
I wanted to know that there are always by default imports in the Android studio when we create new activity. So, we don
SO, we don't have to import some libraries every time, that we will sure that we need in every file.
m

Mark Murphy

10/10/2019, 6:13 PM
The contents of the activity class file that you create from the new-activity wizard come from your chosen template. AFAIK, there is no documented way to change those templates, let alone have those changes survive Studio updates.
p

Priyankkumar Patel

10/10/2019, 6:13 PM
yeah sure
Google is updating a lot
🤣
a

Alexey Belkov [JB]

10/11/2019, 7:34 AM
The docs are here: https://www.jetbrains.com/help/idea/using-file-and-code-templates.html As I see, there is a default template for an Android Activity in the "other" section, but only for Java. You're welcome to submit a feature request to Google to add similar Kotlin templates: http://issuetracker.google.com/.
m

Mark Murphy

10/11/2019, 11:10 AM
That is for an unrelated concept of "templates" that Studio inherits from IDEA. The templates associated with the new-activity and new-project wizards are separate and are not covered by that documentation. Thanks, though!
🙏 1
p

Priyankkumar Patel

10/11/2019, 6:21 PM
Thanks you so much.