<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>Android Tutorial &#8211; Clickable Widgets &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/2010/07/android-tutorial-clickable-widgets/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Sat, 12 Jul 2025 08:01:26 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>Android Tutorial &#8211; Clickable Widgets &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Android Tutorial - Clickable Widgets]]></title>
		<link>https://shkspr.mobi/blog/2010/07/android-tutorial-clickable-widgets/</link>
					<comments>https://shkspr.mobi/blog/2010/07/android-tutorial-clickable-widgets/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Mon, 12 Jul 2010 10:09:42 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[widget]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=2149</guid>

					<description><![CDATA[Another quick Android tutorial.  I couldn&#039;t find an easy or correct method of launching a browser when you click on a homescreen widget.  Well, here it is...  public class clickWidget extends AppWidgetProvider { @Override public void onUpdate( Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds ) { RemoteViews remoteViews =    new RemoteViews( context.getPackageName(),…]]></description>
										<content:encoded><![CDATA[<p>Another quick Android tutorial.  I couldn't find an easy or correct method of launching a browser when you click on a homescreen widget.  Well, here it is...</p>

<pre lang="java">public class clickWidget extends AppWidgetProvider
{
@Override
public void onUpdate( Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds )
{
RemoteViews remoteViews =
   new RemoteViews( context.getPackageName(), R.layout.widget );
remoteViews.setImageViewResource(R.id.ImageView01, drawableResourse);

ComponentName myWidget =
   new ComponentName( context, clickWidget.class );

// Create an Intent to launch Browser
Intent intent =
   new Intent(
      Intent.ACTION_VIEW, Uri.parse("http://example.com")
   );
PendingIntent pendingIntent =
   PendingIntent.getActivity(context, 0, intent, 0);

remoteViews.setOnClickPendingIntent(R.id.ImageView01, pendingIntent);
appWidgetManager.updateAppWidget( myWidget, remoteViews);
}
</pre>

<p>I've used this as the basis of a demo widget - "MI5 Terror Threat Level".  The widget displays the UK's Threat Level on your homescreen.  Clicking on it takes you to the <a href="https://web.archive.org/web/20101014002748/ttps://www.mi5.gov.uk/output/threat-levels.html">MI5 page discussing the threat level</a>.</p>

<p>The threat level is determined by parsing the <a href="https://web.archive.org/web/20101014003201/https://www.mi5.gov.uk/output/threat-level-rss.html">RSS that the security services so helpfully provide</a>.  At the moment, the widget keeps a local copy of the graphics because the <a href="http://www.mi5.gov.uk/UKThreatLevel/UKThreatLevel.xml">RSS feed</a> contains references to "localhost" images.</p>

<p>You can download the widget by scanning in this QR code.
</p><div id="attachment_2155" style="width: 174px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2155" src="https://shkspr.mobi/blog/wp-content/uploads/2010/07/mi5.png" alt="MI5 Widget - QR Code" title="MI5 Widget - QR Code" width="164" height="164" class="size-full wp-image-2155"><p id="caption-attachment-2155" class="wp-caption-text">MI5 Widget - QR Code</p></div><p></p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=2149&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2010/07/android-tutorial-clickable-widgets/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
