It's typical in Android apps for Activity (or closely held code, like
small inner class helpers) to coordinate setting values in views, based
on data stored in the activity.
However, sometimes it doesn't work well, such as when you have a custom
View subclass that does more than display a piece of text or one of
pre-defined images (that could be pushed by the activity):
This is exactly what the OP was asking about:
In my Activity,i will pass some co-ordinate values to the class that
extends View... In this class,i will draw an image and place points
over the image on the required co-ordinates...
I ran into the same thing in my app, implementing a "radar" view for
active WiFi networks. The list is stored in the activity, and can change
at any time, and the view needs to be reflect those changes:
http://kmansoft.files.wordpress.com/2010/06/snap-en-radar.png
There is also a Settings object, that controls, in particular, how the
radar should be drawn.
To me, that's a good place to use an MVC-like pattern.
It seems cleaner than pushing multiple objects into the view, with a
"set" method for each. My Activity subclass always has correct
(up-to-date) data objects, and thus the view is guaranteed to also
always get fresh up-to-date values.
-- Kostya
22.11.2010 2:32, Frank Weiss пишет:
My understanding of MVC and the Android SDK is informed by the
ListView/ListAdapter relationship.
I'm wondering why anyone would suggest and why the OP would suppose
that the Activity should be supplying the model data to the View.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en