Relationship between Widget and main app?

I have a working app which reports a bunch of statistics. I am now wanting to include a couple of widgets that show some summary data so that the user doesn't have to open the app to get to it.

What's the relationship between widgets and apps? Can I reuse the main code or do I need to duplicate some of the code so that the widget can function independently?

Answers


The problem with widgets is that widgets can't be easily updated in real-time and here's why. Widget representation is generated by the application and then passed to launcher for display (this also answers your second question). To refresh the representation periodically you need to setup the timer. But timer handling and refreshing is power-consuming, so you can't set a timer to update the widget every second or so - it will burn the battery quickly.

HTC widgets are special as they have support from HTC Launcher, so they can be animated etc. .


Need Your Help

Basic Node.js examples not working on Windows 7

windows node.js windows-7

I installed node.js from http://nodejs.org/#download, v0.6.6. I am using Windows 7 32-bit.

Web development plugins required but for specific Eclipse installation

java html plugins myeclipse eclipse-3.4

I have to use Eclipse Ganymede 3.4.2. Please don't ask me to upgrade to another version. It is out of my hands.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.