Ah.
Well, you could have a setSomething method in the view, and push the
value from the activity's onCreate - as already suggested by Kumar.
If MyView is only intended to be used by MyActivity, then your original
code seems fine (getting the context, casting to MyActivity and getting
the value). It's not "pretty", and it's not "pure", but why mess with
something that works?
-- Kostya
06.04.2011 13:47, Mike Bear пишет:
The scenario is like the following:
1. MyView is one of the component in MyActivity.
2. MyActivity is created from other activity, with an intent
containing all the information for the activity, including the
parameter for MyView.
3. We shall pass the parameter to the constructor of MyView, for the
construction of it.
I thought of other ways, like use the shared preference, it seems also
work. But not a good way.
--
Kostya Vasilyev -- 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en