[android-developers] Re: How do you manipulate content in an Activity from an external class or another Activity?

2010-12-26 Thread Bret Foreman
Or you could register a receiver in one activity and post Intents from
another. That's how I do it.

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


Re: [android-developers] Re: How do you manipulate content in an Activity from an external class or another Activity?

2010-12-26 Thread Frank Weiss
Or you could use the View-Adapter pattern. The adapter is responsible for
the data model changes and informs the view to redraw via notifications.

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

Re: [android-developers] Re: How do you manipulate content in an Activity from an external class or another Activity?

2010-12-26 Thread Kostya Vasilyev
Or give the other class a Java interface reference for callbacks, 
while implementing the interface in the Android-aware code.


27.12.2010 0:00, Frank Weiss пишет:


Or you could use the View-Adapter pattern. The adapter is responsible 
for the data model changes and informs the view to redraw via 
notifications.


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


[android-developers] Re: How do you manipulate content in an Activity from an external class or another Activity?

2010-12-26 Thread jotobjects


On Dec 21, 2:30 pm, Tobiah t...@tobiah.org wrote:
 Can one Activity manipulate the Views of another?
 Even with a class that is external to the Activity,
 it seems that I need to pass a pointer to the View
 in question around.  I have a subclass of Application
 that I could use to keep the View pointers in.  Will
 that work?  Does it sound necessary?

The other suggestions given in this post are better than your original
concept for several reasons.  For one thing a View is a heavy weight
object for keeping in memory just to accomplish inter-Activity
communication.  In general you want to update the Model, not the
View.  When the Activity is re-started again it can update the View.
For another thing, depending on the launchMode, you might have more
than one instance of the this Activity (and thus its View).


 Thanks,

 Tobiah

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


Re: [android-developers] Re: How do you manipulate content in an Activity from an external class or another Activity?

2010-12-26 Thread Kostya Vasilyev
It's also not very good to keep view references in the application because
of their different lifetimes.

A view is basically only good for as long as its Activity. The application
object lives as long as the process, that is, much longer.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com
27.12.2010 1:18 пользователь jotobjects jotobje...@gmail.com написал:


 On Dec 21, 2:30 pm, Tobiah t...@tobiah.org wrote:
 Can one Activity manipulate the Views of another?
 Even with a class that is external to the Activity,
 it seems that I need to pass a pointer to the View
 in question around.  I have a subclass of Application
 that I could use to keep the View pointers in.  Will
 that work?  Does it sound necessary?

 The other suggestions given in this post are better than your original
 concept for several reasons. For one thing a View is a heavy weight
 object for keeping in memory just to accomplish inter-Activity
 communication. In general you want to update the Model, not the
 View. When the Activity is re-started again it can update the View.
 For another thing, depending on the launchMode, you might have more
 than one instance of the this Activity (and thus its View).


 Thanks,

 Tobiah

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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