| 1 |
package ${packageName}; |
| 2 |
|
| 3 |
import <#if appCompat>android.support.v7.app.ActionBarActivity<#else>android.app.Activity</#if>; |
| 4 |
import android.os.Bundle; |
| 5 |
import android.view.Menu; |
| 6 |
import android.view.MenuItem; |
| 7 |
<#if applicationPackage??>import ${applicationPackage}.R;</#if> |
| 8 |
|
| 9 |
public class ${activityClass} extends ${(appCompat)?string('ActionBar','')}Activity { |
| 10 |
|
| 11 |
@Override |
| 12 |
protected void onCreate(Bundle savedInstanceState) { |
| 13 |
super.onCreate(savedInstanceState); |
| 14 |
setContentView(R.layout.${layoutName}); |
| 15 |
} |
| 16 |
|
| 17 |
@Override |
| 18 |
public boolean onCreateOptionsMenu(Menu menu) { |
| 19 |
// Inflate the menu; this adds items to the action bar if it is present. |
| 20 |
getMenuInflater().inflate(R.menu.${menuName}, menu); |
| 21 |
return true; |
| 22 |
} |
| 23 |
|
| 24 |
@Override |
| 25 |
public boolean onOptionsItemSelected(MenuItem item) { |
| 26 |
// Handle action bar item clicks here. The action bar will |
| 27 |
// automatically handle clicks on the Home/Up button, so long |
| 28 |
// as you specify a parent activity in AndroidManifest.xml. |
| 29 |
int id = item.getItemId(); |
| 30 |
if (id == R.id.action_settings) { |
| 31 |
return true; |
| 32 |
} |
| 33 |
return super.onOptionsItemSelected(item); |
| 34 |
} |
| 35 |
} |