Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android_University_Fall_2020_Week_2.pdf

Marina Tanasyuk
September 26, 2020

 Android_University_Fall_2020_Week_2.pdf

Marina Tanasyuk

September 26, 2020
Tweet

More Decks by Marina Tanasyuk

Other Decks in Education

Transcript

  1. Online course guidelines Make sure to mute yourself Turn on

    your webcam Use chat room during class Keep an eye on Slack: android-remote-fall20 (general announcements) android-help-fall20 (help) ☕ We’ll take breaks during a session!
  2. Flicks App (Part 2) - what do we need to

    know • How to handle a click • How to start a new activity from the existing activity • How to pass data to this new activity • How to play content
  3. New Concept - Intents Activity A Activity B Intent intent

    = new Intent(ActivityA.this, ActivityB.class); startActivity(intent);
  4. Intents - Pass / Receive Data // in Activity A:

    Intent intent = new Intent(ActivityA.this, ActivityB.class); intent.putExtra("key", "some info to send"); startActivity(intent); // in Activity B: protected void onCreate(Bundle savedInstanceState) { … String data = getIntent().getStringExtra(“key"); // data = “some info to send” … }
  5. New Concept - Activity Lifecycle • As User navigates around

    the app Activity instances transition through different states. • The Activity class provides a number of callbacks. • These callbacks allow the activity to know that a state has changed: that the system is creating, stopping, or resuming an activity, or destroying the process in which the activity resides.
  6. System first creates the activity. Perform basic application startup logic

    that should happen only once for the entire life of the activity. Activity is visible and is active in the foreground. Activity is no longer in the foreground (though it may still be visible. Activity is finishing (due to the user completely dismissing the activity or due to finish() being called on the activity), or the system is temporarily destroying the activity due to a configuration change.
  7. Toolbar vs ActionBar The Toolbar is a successor of the

    ActionBar. The key differences that distinguish the Toolbar from the ActionBar include: • Toolbar is a View included in a layout like any other View. • As a regular View, the toolbar is easier to position, animate and control. • Multiple distinct Toolbar elements can be defined within a single Activity. • Toolbar can be configured as an Activity’s ActionBar, meaning that your standard options menu actions will be displayed within.