Search code examples
androidclassumldiagrammodeling

Android Class Diagram UML


I'm trying to create a class diagram for an android project. I want my classes represent the activities, services and interfaces that I will implement.

There are several questions about it on the web, but I couldn't find a definitive answer.

I know that there aren't specific rules for Android and UML, but I have some doubts.

  • How can I represent the relationship between an Activity and a AsyncTask ?
  • How can I indicate that an Activity has an intent to another Activity ?

Maybe if someone has an example, will really help.


Solution

  • Maybe something like this?

    enter image description here

    • MyBackgroundTask IS A AsyncTask
    • MyActivity IS A Activity
    • MyActivity HAS ONE MyBackgroundTask

    You can use a dependency to show that there is an relationship between the AnActivity class and the AnotherActivity class:

    enter image description here

    In this case, it means that the AnActivity class requires the AnotherActivity class for its specification or implementation. Also, use notes to make it clear.

    Update:

    Another example:

    • MainActivity IS A FragmentActivity
    • MainActivity HAS SOME fragments. The fragments are of type String.

    enter image description here