开发者

TabActivity and Local Service: How to consume data from services in each tab?

I'm using Androids TabActivity as described in TabLayout Demo.

In each of these tabs I want to show data in a differently way which should be gathered by a LocalService.

Currently only one of the tab ac开发者_运维技巧tivities consumes my local service. What is the best way that all my tab activities (which are called by intents) consume the data synchronised? (For example one tab activity should show the data in a TextView, an other should show the data on a map...)

Thank you for your help!


I know it's too late, but to solve this problem you can try call getApplicationContext().bindService instead of just bindService.


I have solved (?) my problem by binding my LocalService to the TabActivity now. After that I made the service static and use it by calling a public method in my intents. Is this "good code"?

I would be very grateful if someone can confirm my solution or giving me some hints to make it better!

Thanks!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜