I would like to ask how to create class diagrams for Android
applications.
Example:
There is Activity
MyActivity, which has an onClick method, in which I call another Activity
, or Service
. My question is, what´s the relationship between them?
It´s association?
or MyActivity
uses them?
Or it´s another relationship? Thanks in advance.
Association is a supertype to the various relationships between UML elements. You might use a dependency (MyService depends on MyAcitivity). It is always good practice to give names to relationships which describe their purpose. If you want to lay out a navigation path structure, then I doubt that a class diagram is your best choice. Have you tried to use a sequence diagram?
As far as I can see, Android does not declare onClick for Activity, so you seem to have declared it yourself. If it were provided by Android, you would not have to model the relationship again in your model.