Android Class Diagram UML

雨燕双飞 提交于 2019-12-10 19:41:49

问题


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.


回答1:


Maybe something like this?

  • 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:

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.



来源:https://stackoverflow.com/questions/31975109/android-class-diagram-uml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!