Android Question Widget worries

Martincg

Member
Licensed User
I want a widget for an app I am writing and I've read the tutorials and tried the examples.

I am concerned that to test the widget it is required to run in release mode which makes debugging more difficult, so I thought that it is probably better to create a widget and have the main app send a message to it to update what it displays.
Is this a reasonable approach or am I just confused?

Second question- I have seen an app which can create widgets so that when you choose to add a new option for the app it will automatically generate a widget to show the data for that option. How is that done?
 

Erel

Administrator
Staff member
Licensed User
Is this a reasonable approach or am I just confused?
I don't think that it is worth the efforts. It will be easier to test it with release mode. Use Log messages to better understand what happens.

Second question- I have seen an app which can create widgets so that when you choose to add a new option for the app it will automatically generate a widget to show the data for that option. How is that done?
I'm not sure that I understand this question. You cannot add widgets automatically. The user must add the widget.
 

Martincg

Member
Licensed User
Thanks for your reply Erel.
I don't think that it is worth the efforts. It will be easier to test it with release mode. Use Log messages to better understand what happens.
By Log messages do you mean writing logs to a file?

I'm not sure that I understand this question. You cannot add widgets automatically. The user must add the widget.
That means I understand even less than I thought.
Does this mean that it is necessary to install the app in two stages as far as the user is concerned. That is, you install the app which adds the widget to the list of widgets, the app closes. Then the user must drag the widget onto the home screen and some option provided on the widget brings the app to the front?
I don't understand this because the widget dragged to the home screen is just an instance of the app which could be duplicated?
 

Martincg

Member
Licensed User
You can also monitor the logs from the IDE in release mode.
Oh, - now I've noticed the "#BridgeLogger" message, thanks Erel.
I think that I want a widget so that I can show changing information. But if a shortcut can do that then it might be suitable. I will read up on shortcuts.

Things which are generally obvious can be completely misunderstood by a novice like me. The following is what I believe I understand now but didn't 2 days ago.
When you write the code for a widget in your app it only tells the OS to add the representation of the widget to the widget list if it doesn't already exist. If for example you remove the widget from the list it will not remove instances of the widgets on the home screen, but starting the program again will replace it. When you actually add the widget to the home screen the OS creates a separate and simple object which doesn't have any of the code that the app has and which is not part of the app. Special methods have to be used in the app to communicate with it.

If that is incorrect please tell me anyone.
 
Top