Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 285
G_comp Avatar asked Feb 26 '26 15:02

G_comp


1 Answers

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

like image 186
sergej Avatar answered Mar 01 '26 07:03

sergej



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!