Several of Widget

bgsoft

Well-Known Member
Licensed User
Longtime User
Hello

After reading:
Android home screen widgets tutorial - part I and part II I have some doubts.

I created a widget that checks if the phone is charging through the library Phone with BatteryChanged event.
It works perfectly, but if I hold down the menu button and delete applications, and stops entering the service of the widget, although in the event: Service_Destroy, not enter.
The only way to re-run the widget service is by clicking the widget icon.
My question is: I can pass the focus to the widget to work? is there any way to know that the service is stopped?

Other queries about widget:
- What is the maximum size of the panel to place the image in a 1x1 widget? if I get over 74, makes a 1 x 2.
- The text of witget once put on the home screen, as is done? I put a label below the image but not knowing the measures not go well the letters.

thanks

Jesus
 

bgsoft

Well-Known Member
Licensed User
Longtime User
I found a solution to that deleting background applications do not stop the widget service.

In the Service_Start, I again call the service every x seconds.

B4X:
StartServiceAt ("", DateTime.Now + 20 * DateTime.TicksPerSecond, True)
[/ code]

I would like someone to tell me another way to consume less resources.

thanks

Jesus
 
Upvote 0

bgsoft

Well-Known Member
Licensed User
Longtime User
Thanks for your answer. But I still have doubts.


a) In some ways I have to know that cell size corresponds to a resolution of a device.

b) Where to put the text widget, a label?

c) Where I have to put that label to come out centered? (width, height, left and right)

d) What type of text I have to put to be the standard of the home screen?

I found that if the panel for more than 74 x 74, happens to have more than one cell. This does not allow to put a "normal" text. Attached is a widget image with a rectangle marked in black. Shows that cuts letters.

thanks

Jesús
 

Attachments

  • Screenshot_2013-06-12-18-16-42.jpg
    Screenshot_2013-06-12-18-16-42.jpg
    78.8 KB · Views: 277
Upvote 0

bgsoft

Well-Known Member
Licensed User
Longtime User
Yes, I did. But if the image is smaller than the panel, and you slide, but put the CenterWidger to true, take the position of Designer.
The designer has priority over the code. (I have it checked)

B4X:
rv = ConfigureHomeWidget("layout", "rv", 0, "Avisar USB desconectado",True)


thanks

Jesús
 
Upvote 0

bgsoft

Well-Known Member
Licensed User
Longtime User
Thanks Erel

I copy the layout

Greetings:

Jesus
 

Attachments

  • widget.zip
    6.6 KB · Views: 197
Upvote 0
Top