15
ANDROID PROGRAMMING A QUICK GUIDE TO A BASIC TRIVIA GAME EXAMPLE

ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

ANDROID PROGRAMMINGA QUICK GUIDE TO A BASIC TRIVIA GAME EXAMPLE

Page 2: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

ABOUT ANDROID

• Can use Java or Kotlin Programming

Languages

• Doesn’t require Android Device �

Can use an emulator

• All development takes place in the

Android Studio IDE

• https://developer.android.com/studi

o/

Page 3: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

STARTING AN

ACTIVITY

• Activity Class

• OnCreate

• Sets a layout

Page 4: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

EDITING THE

LAYOUT

• Text Mode vs. Design Mode

Page 5: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

EDITING THE

LAYOUT

• Text Mode vs. Design Mode

Page 6: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

CONSTRAINT

LAYOUTS

• Add Constraints based on

surrounding objects

• “Parents”

• Other buttons

• Use layout margins as well

Page 7: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

ADDING TEXT AND

BUTTONS

• Layout elements called ”Views”

• TextView

• Button

• Add them by text or drag & drop

Page 8: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

ADDING SCROLL TEXT

• Same as Textview, just edit some of

the attributes

• android:scrollbars="vertical"

Page 9: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

DESIGNING A POPUP

• Create a separate layout

Page 10: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

USING STYLES,

COLORS, AND

STRINGS• All about refactoring code

Page 11: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

LOOKING AT THE CODE

• Global variables

Page 12: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

FINDING AND

SETTING VIEWS

Page 13: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

SETTING BUTTON

FUNCTIONALITY

• OnClick Listeners

Page 14: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

CREATING THE

POPUP

Page 15: ANDROID PROGRAMMING · 2019-02-22 · activity_main.xml Popup.xml Colors.xml Styles.xml x x Nexus 4 TriviaGame x 28 MainActivity.java AppTheme 55% Attributes layout_width layout_height

ADDING POPUP LOGIC