1package com.android.layoutlib.test.myapplication; 2 3import android.app.Activity; 4import android.os.Bundle; 5import android.view.Menu; 6import android.view.MenuItem; 7 8public class MyActivity extends Activity { 9 10 @Override 11 protected void onCreate(Bundle savedInstanceState) { 12 super.onCreate(savedInstanceState); 13 setContentView(R.layout.activity); 14 } 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.my, 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} 36