• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.layoutlib.test.myapplication;
2 
3 import android.app.Activity;
4 import android.os.Bundle;
5 import android.view.Menu;
6 import android.view.MenuItem;
7 
8 public class MyActivity extends Activity {
9 
10     @Override
onCreate(Bundle savedInstanceState)11     protected void onCreate(Bundle savedInstanceState) {
12         super.onCreate(savedInstanceState);
13         setContentView(R.layout.activity);
14     }
15 
16 
17     @Override
onCreateOptionsMenu(Menu menu)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
onOptionsItemSelected(MenuItem item)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