]> git.somenet.org - android/helloworld.git/blob - app/src/main/java/org/somenet/android/helloworld2/MainActivity.java
Added "DEBUG" Title to debuggable builds.
[android/helloworld.git] / app / src / main / java / org / somenet / android / helloworld2 / MainActivity.java
1 package org.somenet.android.helloworld2;
2
3 import android.content.pm.ApplicationInfo;
4 import android.support.v7.app.AppCompatActivity;
5 import android.os.Bundle;
6 import android.view.Menu;
7 import android.view.MenuItem;
8
9 public class MainActivity extends AppCompatActivity {
10
11     @Override
12     protected void onCreate(Bundle savedInstanceState) {
13         super.onCreate(savedInstanceState);
14         setContentView(R.layout.activity_main);
15         if ((0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))) {
16             setTitle(getTitle() + " DEBUG");
17         }
18     }
19
20     @Override
21     public boolean onCreateOptionsMenu(Menu menu) {
22         // Inflate the menu; this adds items to the action bar if it is present.
23         getMenuInflater().inflate(R.menu.menu_main, menu);
24         return true;
25     }
26
27     @Override
28     public boolean onOptionsItemSelected(MenuItem item) {
29         // Handle action bar item clicks here. The action bar will
30         // automatically handle clicks on the Home/Up button, so long
31         // as you specify a parent activity in AndroidManifest.xml.
32         int id = item.getItemId();
33
34         //noinspection SimplifiableIfStatement
35         if (id == R.id.action_settings) {
36             return true;
37         }
38
39         return super.onOptionsItemSelected(item);
40     }
41 }