CompositeAndroid Course

Welcome to CompositeAndroid's Online training with live Instructor using an interactive cloud desktop environment DaDesktop.

Experience remote live training using an interactive, remote desktop led by a human being!

7 hours
1 656 €
background image

CompositeAndroid Overview

What is CompositeAndroid?


Composition over inheritance Allows to add functionality into an Android Activity. Just because we all have a BaseActivity in our projects containing too much unused stuff. When it grows, it get unmaintainable.

Possible Usecases

State of the Art

Given you have an Activity showing a list of tweets (TweetStreamActivity) and you want add view tracking.

Inheritance

You could do it with inheritance and use TrackedTweetStreamActivity from now on: public class TrackedTweetStreamActivity extends TweetStreamActivity { @Override protected void onResume() { super.onResume(); Analytics.trackView("stream"); } } more likely you would create a TrackedActivity and extend the TweetStreamActivity from it: public abstract class TrackedActivity extends AppCompatActivity { public abstract String getTrackingName(); @Override protected void onResume() { super.onResume(); Analytics.trackView(getTrackingName()); } } public class TrackedTweetStreamActivity extends TrackedActivity { @Override public String getTrackingName() { return "stream"; } } Both solutions work but don't scale well. You'll most likely end up with big inheritance structures: class MvpActivity extends AppCompatActivity { ... } class BaseActivity extends AppCompatActivity { ... } class BaseMvpActivity extends MvpActivity { ... } class WizardUiActivity extends BaseActivity { ... } class TrackedWizardUiActivity extends WizardUiActivity { ... } class TrackedBaseActivity extends BaseActivity { ... } class TrackedMvpBaseActivity extends BaseMvpActivity { ... }

Delegation

Some libraries out there provide both, a specialized Activity extending AppCompatActivity and a delegate with a documentation when to call which function of the delegate in your Activity. public class TrackingDelegate { /**

  • usage:
  • {@code
  •  
  • @Override
  • protected void onResume() {
  • super.onResume();
  • mTrackingDelegate.onResume();
  • }
  • } */ public void onResume() { Analytics.trackView(""); } } public class TweetStreamActivity extends AppCompatActivity { private final TrackingDelegate mTrackingDelegate = new TrackingDelegate(); @Override protected void onResume() { super.onResume(); mTrackingDelegate.onResume(); } } This is an elegant solution but breaks when updating such a library and the delegate call position has changed. Or when the delegate added new callbacks which don't get automatically implemented by increasing the version number in the build.gradle.

    Composite Android solution

    CompositeAndroid let's you add delegates to your Activity without adding calls to the correct location. Such delegates are called Plugins. A Plugin is able to inject code at every position in the Activity lifecycle. It is able to override every method.

Course Category: Mobile Development

Would you like to learn CompositeAndroid?


Simply, click the "Book" button of CompositeAndroid and proceed to the payment method. Enter your desired schedule of training. You will receive an email confirmation for CompositeAndroid and a representative / trainer will get in touch with you.

What you get

Money back guarantee

If the course CompositeAndroid doesn't have a trainer available on your preferred schedule, you may withdraw your payment.

Remote session with live human

Trainings for CompositeAndroid are not pre-recorded video. You may interact with your instructor in real-time.

Instructor access to revolutionary training environment DaDesktop

DaDesktop is an interactive cloud desktop environment solution for trainers and participants.

Training materials for the course CompositeAndroid

Certificate of completion for the course CompositeAndroid

Entry in certified person catalog for the course CompositeAndroid