diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-02-07 13:56:13 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-02-07 13:56:13 +0100 |
commit | bfe835a58edab5d41831f87e86ec534786db4d4e (patch) | |
tree | f1ef2d1fe18fcf7f5b949ec021012d64764f626d /same-android/src/main/java/com/orbekk/MainActivity.java | |
parent | 0f5172c073daad5022409344aa25a176beaba431 (diff) |
Add settings menu to Android app.
– New main activity.
– Options menu to go to Same settings.
Diffstat (limited to 'same-android/src/main/java/com/orbekk/MainActivity.java')
-rw-r--r-- | same-android/src/main/java/com/orbekk/MainActivity.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/same-android/src/main/java/com/orbekk/MainActivity.java b/same-android/src/main/java/com/orbekk/MainActivity.java new file mode 100644 index 0000000..80c4f6e --- /dev/null +++ b/same-android/src/main/java/com/orbekk/MainActivity.java @@ -0,0 +1,29 @@ +package com.orbekk; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.widget.Toast; + +public class MainActivity extends Activity { + @Override public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + } + + @Override public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.main_menu, menu); + return true; + } + + @Override public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == R.id.same_settings) { + startActivity(new Intent(this, SameControllerActivity.class)); + } + return true; + } +} |