开发者

Android - Updating TextView String through AIDL Service

I have an app that uses a TabHost. Several of the Tabs share a common HUD. I am using a service to periodically update those values by calling an AIDL function when ready.

However, since several of the Tabs are using the same HUD I would like to abstract that part out.

I thought about having the HUD.xml use a String resource as it's v开发者_如何学运维alue and then the abstracted class can update the String resource. However, apparently Android can not update String resources programatically.

The only alternative solution I see would be using SharedPreference. I have concerns accessing a Database everytime the value is refreshed.

Can anyone please share some options with me.

Thank you


However, apparently Android can not update String resources programatically.

Correct.

The only alternative solution I see would be using SharedPreference. I have concerns accessing a Database everytime the value is refreshed.

Shared preferences are not stored in a database. They are stored in an XML file.

Can anyone please share some options with me.

Have the service broadcast an Intent when it changes the data. Or, have the service call listener objects supplied by the tabs. There's probably a half-dozen other options as well, but those two should get you started down the path.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜