0

I am designing a video conference application for android using flex and red5 on the server side. I have 3 views: **Chat View(text chat) - Streams View(where the other users streams will be shown) and Me View(where your own camera will be shown) **.

Now the problem is that whenever I switch views, for instance from chat view to the streams view, the incoming chat messages wont be received.Is there a way to fix this. I want the incoming chat messages to be shown even after switching to another view. Any help will be appreciated. I have attached some pictures:

First I open the app from my mobile as [jamie] and go to the members tab (ie. the streams view) where the user [clientFromWindows]'s stream is showing: viewi

Now I start sending messages from [clientFromWindows] which is the android emulator running the same app:

enter image description here

Now,in my phone, when I go back to the Chat view,ie. chat view of [jamie] the messages shown by [clientFromWindows] is not showing.

enter image description here

Please help.

zero323
  • 322,348
  • 103
  • 959
  • 935

1 Answers1

0

To do what you'd like, you will need to have a controller, a presentation model, a singleton, or 'insert your design pattern here' that exists outside of your views. This controller would contain all of the logic to get data from your server and update your application's model.

Thusly, when you went from the chat view to the video view, the controller will still be in communication w/the server to receive new chat messages. New chat messages would be added to your application's "chat model". The next time the user visits the chat view, the new messages can be rendered from the model.

Because a mobile device has limited resources (compared to a desktop/laptop), View classes in a Flex mobile app are meant to be disposed of when you navigate away from them.

I've simplified this a bit, your controller wouldn't necessarily communicate w/the server, you might delegate communication with the back end to another class. But for the purposes of explanation, I'm leaving out the design patterns and/or best practices that one might follow in building a MVC application.

Sunil D.
  • 17,983
  • 6
  • 53
  • 65
  • Thank you Sunil,Actually I did think of using the Model View pattern. I will try that now. So the controller will be the application itself and it will update its views when required? – Biswas Lamichhane Feb 18 '13 at 14:55
  • Yes that's it. Two common ways to update the view are to bind the view to objects/properties on the model (or some other non-view class), and to [pass data to the view](http://www.remotesynthesis.com/post.cfm/passing-data-across-views-in-flex-mobile) when you push/pop the `View` class. – Sunil D. Feb 18 '13 at 17:44