CompositeAndroid Course

Welcome to CompositeAndroid Online Course 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


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.


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 { ... }


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.

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.

Course Category:

   Mobile Development Training

Course Schedules

Date Time
November 9, 2021 (Tuesday) 09:30 AM - 04:30 PM
November 23, 2021 (Tuesday) 09:30 AM - 04:30 PM
December 7, 2021 (Tuesday) 09:30 AM - 04:30 PM
December 21, 2021 (Tuesday) 09:30 AM - 04:30 PM
January 4, 2022 (Tuesday) 09:30 AM - 04:30 PM
January 18, 2022 (Tuesday) 09:30 AM - 04:30 PM

CompositeAndroid consultancy is available.

Let us know how we can help you.