Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find the Android Studio templates for Activity and gradle script?

I am using the new appCompat v22.1, and I would like to change the templates used by Android Studio.

Currently, the Android Studio templates create Activities that extend ActionBarActivity which has been deprecated in v22.1. I would like to switch to AppCompatActivity without changing the code each time.

Is it possible to change them without waiting for the next Android Studio update?

like image 781
Angela Avatar asked Sep 29 '22 04:09

Angela


1 Answers

Yes it can be done:

Activity templates are located here: [ANDROID_STUDIO_DIR]\plugins\android\lib\templates\activities

  1. find the template you want to change

  2. open \XXXActivity\root\src\app_package\XXXActivity.java.ftl, find and replace import of ActionBarActivity and ActionBarActivity with AppCompatActivity.

like image 100
Kai Avatar answered Oct 05 '22 06:10

Kai