I would like to change the template so that the new activity uses AppCompatActivity
instead of the depreciated ActionBarActivity
I found sdk\tools\templates\activities\BlankActivity\root\src\app_package\SimpleActivity.java.ftl
and after making a backup copy I changed
import <#if appCompat>android.support.v7.app.ActionBarActivity<#else>android.app.Activity</#if>;
to
import <#if appCompat>import android.support.v7.app.AppCompatActivity<#else>android.app.Activity</#if>;
and
public class ${activityClass} extends ${(appCompat)?string('ActionBar','')}Activity {
to
public class ${activityClass} extends ${(appCompat)?string('AppCompat','')}Activity {
but when I create a new activity it still uses ActionBarActivity.
I just change two position:
1.import <#if appCompat>android.support.v7.app.AppCompatActivity<#else>android.app.Activity;
2.public class ${activityClass} extends ${(appCompat)?string('AppCompat','')}Activity {
And it's work for me!
I see you code, your first edit has one more "import" string. -_-|||
Edit:
By the way, I edit SimpleActivity.java.ftl
under Android-Studio folder:"X:\xxxx\android-studio\plugins\android\lib\templates\activities\BlankActivity\root\src\app_package"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With