Zoom: Developers

Responding To Widget Clicks

Zoom allows any application to easily respond to one of it's widget element clicks. If the user selects Broadcast Click as the action for an element, the following intent will be broadcast each time the element is clicked:

Data: widget://WidgetName/ElementName

Here's how you register to receive that in code:

	new IntentFilter( net.dinglisch.android.zoom.ACTION_CLICK ).addDataScheme( "widget" ),
	new BroadcastReceiver() {
		public void onReceive( Context c, Intent i ) {
			Uri data = i.getData();

			String widgetName = data.getAuthority();
			String elementName = data.getLastPathSegment();

			// do something here

You probably want to track your receiver so you can unregister it later, however.

Change Widget Data

You can also send an intent to change most of the attributes of a widget or one of it's elements. Your manifest should have the permission net.dinglisch.android.zoom.permission.MAKE_CHANGES (though this is not enforced ATM due to limitations of the Android permission mechanism).


ElementName should be empty if widget attributes are being changed i.e. there should only be a / after the widget name.

Reference is optional and only necessary if you need to create several PendingIntents referring to the same widget or element. It is ignored by Zoom.

The extras of the intent specify attribute/value pairs. You can include as many as you like.

Widget Attributes
Attribute Type Notes
marginWidth int
backColour string #AARRGGBB
borderWidth int
borderColour string #AARRGGBB
visible boolean
Base Element Attributes
Applicable to all element types.
Attribute Type Notes
xPort int
yPort int
widthPort int
heightPort int
xLand int
widthLand int
heightLand int
visible boolean
visibleToggle Stringoff, on or toggle
activeState 1..no_states
height String affects port and land, +INTVAL or -INTVAL or INTVAL
width String affects port and land, +INTVAL or -INTVAL or INTVAL
Button Element Attributes
Attribute Type Notes
text string
textColourstring #AARRGGBB
textSize int
textScaleWidthfloat<= 1.0
Text Element Attributes
Attribute Type Notes
text string
textColour string #AARRGGBB
textSize int
textScaleWidthfloat<= 1.0
centre boolean
startLine Stringwhich line of text to display first, +INTVAL, -INTVAL or INTVAL (starting at 1)
Image Element Attributes
Attribute Type Notes
uri string schemes: file/content/icon
alpha int 0-255
The scheme icon refers to a cached application icon in the device internal memory. The path is the package name of the app and ends in the simple class name of the activity.

Oval / Rectangle Element Attributes
Attribute Type Notes
colour string

	Intent i = new Intent( "net.dinglisch.android.zoom.CHANGE_WIDGET" );
	i.setData( Uri.parse( "widget://mywidget/button1" ) );
	i.putExtra( "label", "Press Me! Press Me!" );
	i.putExtra( "textSize", 12 );
	sendBroadcast( i );

Don't forget, you should declare the permission in your manifest:

<uses-permission android:name="net.dinglisch.android.zoom.permission.MAKE_CHANGES">