aboutsummaryrefslogtreecommitdiffstats
path: root/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl
diff options
context:
space:
mode:
Diffstat (limited to 'templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl')
-rw-r--r--templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl18
1 files changed, 17 insertions, 1 deletions
diff --git a/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl
index feae824..7edd647 100644
--- a/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl
+++ b/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl
@@ -6,6 +6,10 @@ import android.view.Menu;
<#if parentActivityClass != "">
import android.view.MenuItem;
import android.support.v4.app.NavUtils;
+<#if minApiLevel < 11>
+import android.annotation.TargetApi;
+import android.os.Build;
+</#if>
</#if>
public class ${activityClass} extends Activity {
@@ -16,10 +20,22 @@ public class ${activityClass} extends Activity {
setContentView(R.layout.${layoutName});
<#if parentActivityClass != "">
// Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
+ setupActionBar();
</#if>
}
+ <#if parentActivityClass != "">
+ /**
+ * Set up the {@link android.app.ActionBar}<#if minApiLevel < 11>, if the API is available</#if>.
+ */
+ <#if minApiLevel < 11>@TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ </#if>private void setupActionBar() {
+ <#if minApiLevel < 11>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {</#if>
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+ <#if minApiLevel < 11>}</#if>
+ }
+ </#if>
+
<#include "include_onCreateOptionsMenu.java.ftl">
<#include "include_onOptionsItemSelected.java.ftl">