From 7947c739340034a78af09f4cd861df876927fb0e Mon Sep 17 00:00:00 2001 From: glwhitney Date: Fri, 11 Mar 2016 11:35:22 -0800 Subject: [PATCH 1/2] Contributions to Android These folders and files are submitted to provide more source code for Bucky's Android Beginners tutorials --- .../012 User Interface.txt | 106 ++++++++ .../013-016 Java Layout.txt | 96 +++++++ .../017 GridLayout/017 GridLayout.txt | 96 +++++++ .../018-020 Events/018 to 19 Events.txt | 59 ++++ .../018-020 Events/020 Multiple Events.txt | 67 +++++ .../31 to 32 MasterDetailFlow.txt | 257 ++++++++++++++++++ .../033 Overflow Menu/033 Overflow menu.txt | 130 +++++++++ .../034 Transition/34 Transition.txt | 94 +++++++ .../035-036 Intents/35 to 36 Intents.txt | 198 ++++++++++++++ .../039-040 Threads/39 to 40 Threads.txt | 127 +++++++++ .../41 to 42 Intent Service.txt | 220 +++++++++++++++ .../43 to 44 Bound Services.txt | 141 ++++++++++ .../45 to 46 Simple List Items.txt | 55 ++++ .../47 to 48 Custom List Items.txt | 120 ++++++++ .../049-054 SQLite/49 to 54 SQLite.txt | 219 +++++++++++++++ .../055 Play Video/55 Play Video.txt | 50 ++++ .../56 to 57 Camera Intent.txt | 94 +++++++ .../61 to 62 Notifications.txt | 71 +++++ .../63 to 64 Styles and Themes.txt | 150 ++++++++++ .../65 to 66 Shared Preferences.txt | 134 +++++++++ 20 files changed, 2484 insertions(+) create mode 100644 Android_Beginners/011-012 User Interface/012 User Interface.txt create mode 100644 Android_Beginners/013-016 Java Layout/013-016 Java Layout.txt create mode 100644 Android_Beginners/017 GridLayout/017 GridLayout.txt create mode 100644 Android_Beginners/018-020 Events/018 to 19 Events.txt create mode 100644 Android_Beginners/018-020 Events/020 Multiple Events.txt create mode 100644 Android_Beginners/031-032 MasterDetailFlow/31 to 32 MasterDetailFlow.txt create mode 100644 Android_Beginners/033 Overflow Menu/033 Overflow menu.txt create mode 100644 Android_Beginners/034 Transition/34 Transition.txt create mode 100644 Android_Beginners/035-036 Intents/35 to 36 Intents.txt create mode 100644 Android_Beginners/039-040 Threads/39 to 40 Threads.txt create mode 100644 Android_Beginners/041-042 Intent Service/41 to 42 Intent Service.txt create mode 100644 Android_Beginners/043-044 Bound Services/43 to 44 Bound Services.txt create mode 100644 Android_Beginners/045-048 List Items/45 to 46 Simple List Items.txt create mode 100644 Android_Beginners/045-048 List Items/47 to 48 Custom List Items.txt create mode 100644 Android_Beginners/049-054 SQLite/49 to 54 SQLite.txt create mode 100644 Android_Beginners/055 Play Video/55 Play Video.txt create mode 100644 Android_Beginners/056-057 Camera Intent/56 to 57 Camera Intent.txt create mode 100644 Android_Beginners/061-062 Notifications/61 to 62 Notifications.txt create mode 100644 Android_Beginners/063-064 Styles and Themes/63 to 64 Styles and Themes.txt create mode 100644 Android_Beginners/065-066 Shared Preferences/65 to 66 Shared Preferences.txt diff --git a/Android_Beginners/011-012 User Interface/012 User Interface.txt b/Android_Beginners/011-012 User Interface/012 User Interface.txt new file mode 100644 index 0000000..3323fa5 --- /dev/null +++ b/Android_Beginners/011-012 User Interface/012 User Interface.txt @@ -0,0 +1,106 @@ +[source code] Android Development Tutorials - 11 & 12 - User Interface + +***** Main Activity.java +package your.package.name + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} + + +***** activity_main.xml + + + + + + + + + +