<?xml version="1.0" encoding="UTF-8"?>
<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>lexanderA &#187; Android</title>
	<atom:link href="http://lexandera.com/category/android/feed/" rel="self" type="application/rss+xml" />
	<link>http://lexandera.com</link>
	<description>A blog about the web, mobile web, semantic web and mobile semantic web.</description>
	<lastBuildDate>Sun, 06 Jun 2010 18:27:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Replacing menus with dashboards</title>
		<link>http://lexandera.com/2009/09/replacing-menus-with-dashboards/</link>
		<comments>http://lexandera.com/2009/09/replacing-menus-with-dashboards/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 09:00:23 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[Menu]]></category>
		<category><![CDATA[tabs]]></category>
		<category><![CDATA[url field]]></category>
		<category><![CDATA[UX]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=485</guid>
		<description><![CDATA[Is it just me, or do most dialogs on Android seem to be removed really, really far away from the main parts of applications?
Not sure what I&#8217;m talking about?
Let&#8217;s take a look at the browser, for example. Just entering a new URL requires you to go through 3 different screens:

By the time you can start [...]]]></description>
			<content:encoded><![CDATA[<p>Is it just me, or do most dialogs on Android seem to be removed really, really far away from the main parts of applications?</p>
<p>Not sure what I&#8217;m talking about?</p>
<p>Let&#8217;s take a look at the browser, for example. Just entering a new URL requires you to go through 3 different screens:</p>
<p><a href="http://lexandera.com/wp-content/uploads/2009/09/1_current.png"><img class="alignnone size-full wp-image-498" src="http://lexandera.com/wp-content/uploads/2009/09/1_current_small.png" alt="" width="714" height="180" /></a></p>
<p>By the time you can start typing it feels like you&#8217;re already in a different application<sup class='footnote'><a href='#fn-485-1' id='fnref-485-1'>1</a></sup>. Switching to a different window also involves going to a special part of the application designed to handle this single task.</p>
<p>This pattern is not limited just to the browser. Entering an address in the maps application or searching the list of your contacts also involves going through several steps.</p>
<p>Back to the browser&#8230;</p>
<p>If you take a look the UI of a regular browser you can immediately see a number of frequently used elements such as the location bar, the back button and tabs for switching between windows. Those UI elements are always visible and usable with a single click. On mobile devices things are a bit different. Because of limited screen sizes most of browser&#8217;s UI is either eating away precious screen real estate (like on the iPhone) or is hidden behind a menu button (like on Android).</p>
<p>Except that because of the nature of menus, many of those features are not hidden just behind the menu button, but also behind an item on that menu.</p>
<p>Now, just as I&#8217;m typing this, <a class="zem_slink" title="Marissa Mayer" rel="wikipedia" href="http://en.wikipedia.org/wiki/Marissa_Mayer">Marissa Mayer</a> is on the stage at <a class="zem_slink" title="TechCrunch50" rel="homepage" href="http://www.TechCrunch50.com">TechCrunch50</a> introducing <a href="http://fastflip.googlelabs.com/">Google fast flip</a> and talking about how Google is obsessed with speed and shaving milliseconds off of repetitive interactions. So what can can we do to speed up interaction with Google&#8217;s mobile browser?</p>
<p>First, we need to understand what&#8217;s wrong with menus.</p>
<p>A typical menu is a list of actions available for that application, but most of those actions can&#8217;t be performed from the menu itself. Instead, selecting an item takes you somewhere else where that action can finally be performed. In essence, a menu keeps asking the question &#8220;What do you want to do?&#8221; over and over again and the user then needs to explicitly say that he wants to go to to the place where he can type in an URL or go to the place where he can switch to a different window, etc.</p>
<p>How do we handle this situation where we know that in many applications the user&#8217;s answer to the menu&#8217;s question is going to be the same most of the time?</p>
<p>Like it is the case usually these days, the solution can already be found on the iPhone. No real surprise there. The iPhone doesn&#8217;t have built-in support for application menus which could be copied, but it does have this:</p>
<p><a href="http://lexandera.com/wp-content/uploads/2009/09/music_dashboard.png"><img class="alignnone size-full wp-image-499" src="http://lexandera.com/wp-content/uploads/2009/09/music_dashboard.png" alt="" width="211" height="159" /></a></p>
<p>What you&#8217;re looking at is a special dashboard for controlling music playback, which can be brought up by pressing the home button twice.</p>
<p>With a bit of bad luck &#8211; or bad judgment &#8211; this could have easily been implemented as a list of items such as &#8220;adjust volume&#8221; and &#8220;control playback&#8221;, with each of them leading to a new screen where that action could be performed. But instead its designers made it possible to perform common actions directly from the pop-up and added a &#8220;Music&#8221; button that takes you to that other app where the rest of the playback controls are.</p>
<p>So let&#8217;s take this dashboard pattern and apply it to Android&#8217;s browser menu:</p>
<p><a href="http://lexandera.com/wp-content/uploads/2009/09/2_alt1.png"><img class="alignnone size-full wp-image-500" title="2_alt1_small" src="http://lexandera.com/wp-content/uploads/2009/09/2_alt1_small.png" alt="2_alt1_small" width="544" height="180" /></a></p>
<p>While some features (like bookmarks) still remain hidden behind a menu button, the two most commonly used ones are immediately presented in usable form. The &#8220;go&#8221; button is replaced by an actual location bar and the &#8220;Windows&#8221; button is replaced by thumbnails of windows. You now no longer need to announce first that you want to go to a different page or switch to a different tab; you can perform that action directly instead.</p>
<p>A quick before/after comparison:</p>
<div>
<table id="c0m_" border="0" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody style="font-size:90%;">
<tr>
<td style="border-bottom: 1px solid grey;"><strong>Action</strong></td>
<td style="border-bottom: 1px solid grey;"><strong>Before</strong></td>
<td style="border-bottom: 1px solid grey;"><strong>After</strong></td>
</tr>
<tr>
<td>Loading a web page</td>
<td>press &#8220;menu&#8221; → press &#8220;go&#8221; → focus URL field (3 steps)</td>
<td>press &#8220;menu&#8221; → focus URL field (2 steps)</td>
</tr>
<tr>
<td>Switching to a different window</td>
<td>press &#8220;menu&#8221; → press &#8220;tabs&#8221; → select tab (3 steps)</td>
<td>press &#8220;menu&#8221; → select tab (2 steps)</td>
</tr>
</tbody>
</table>
</div>
<p>Removing a single step here and there may not seem like much, but it adds up. Making a typo in the URL or working with several windows suddenly becomes just a little bit less frustrating. A simple improvement that can be achieved simply by ignoring the established meaning of the word &#8220;menu&#8221;.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=6586ad72-cb6a-4cc4-902f-85df0363cdfb" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-485-1'>Sure, if you have a phone with a physical keyboard you can just start typing and invoke the default action without going through menus, but what if your phone uses an onscreen keyboard or if you want to use some other action? <span class='footnotereverse'><a href='#fnref-485-1'>&#8617;</a></span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/09/replacing-menus-with-dashboards/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How is Mosembro different from OilCan?</title>
		<link>http://lexandera.com/2009/02/how-is-mosembro-different-from-oilcan/</link>
		<comments>http://lexandera.com/2009/02/how-is-mosembro-different-from-oilcan/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 03:42:24 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mosembro]]></category>
		<category><![CDATA[Microformat]]></category>
		<category><![CDATA[OilCan]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=286</guid>
		<description><![CDATA[



Image via Wikipedia



If you looked at OilCan &#8211; a Greasemonkey-like browser extension for Android &#8211; and Mosembro, you&#8217;d quickly realize that they have a lot in common. Both are experimental browser extensions which run on Android, both aim to make websites friendlier, both support installable actions written in JavaScript, and both make it possible for [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 212px;">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/Image:Android-logo.svg"><img title="Alternate logo." src="http://upload.wikimedia.org/wikipedia/en/thumb/c/c2/Android-logo.svg/202px-Android-logo.svg.png" alt="Alternate logo." width="202" height="202" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/Image:Android-logo.svg">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>If you looked at <a href="http://www.jsharkey.org/blog/2008/12/15/oilcan-greasemonkey-on-steroids-for-android/">OilCan</a> &#8211; a <a class="zem_slink" title="Greasemonkey" rel="homepage" href="http://www.greasespot.net">Greasemonkey</a>-like browser extension for <a class="zem_slink" title="Android" rel="homepage" href="http://code.google.com/android/">Android</a> &#8211; and <a href="/mosembro/">Mosembro</a>, you&#8217;d quickly realize that they have a lot in common. Both are experimental browser extensions which run on Android, both aim to make websites friendlier, both support installable actions written in JavaScript, and both make it possible for those scripts to modify web pages and launch other applications. And since looking at OilCan&#8217;s source code has allowed me to avoid reinventing the wheel at several occasions, some pretty obvious similarities can also be spotted at the source code level.</p>
<p>So, with so many things in common, how are they different at all?</p>
<p>The main difference, I believe, is what causes user scripts to be triggered. A typical OilCan script is triggered by a web page&#8217;s URL and is executed only once. Its goal is to change the content or functionality of a very specific document. Mosembro scripts, on the other hand, are triggered by embedded microformats and can be executed dozens of times for each page, while not caring about which page they were executed on.</p>
<p>I could say at this point that OilCan&#8217;s approach to invoking scripts could be compared to function calls in programming languages and Mosembro&#8217;s approach compared to what is done in aspect oriented programming, with functionality implemented by actions attached to bits of semantic content being <a href="http://en.wikipedia.org/wiki/Cross-cutting_concern">cross-cutting concerns</a>, but I&#8217;m not sure about it, so I won&#8217;t. ;-)</p>
<p>Also, because Mosembro is very narrowly focused on adding functionality to web pages based on semantic data embedded in them it can also provide additional infrastructure, like microformat parsers and action menus, which wouldn&#8217;t exactly fit in with a more general purpose framework. And finally, there&#8217;s the integrated support for site-level search.</p>
<p>So, there you have it. While it&#8217;s true that both apps have a lot in common, it&#8217;s their unique features that really matter.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/c8ae4d89-28da-43e3-8556-0ee417dbfa47/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=c8ae4d89-28da-43e3-8556-0ee417dbfa47" alt="Reblog this post [with Zemanta]" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/02/how-is-mosembro-different-from-oilcan/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mosembro r5 now available for download</title>
		<link>http://lexandera.com/2009/02/mosembro-r5-now-available-for-download/</link>
		<comments>http://lexandera.com/2009/02/mosembro-r5-now-available-for-download/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 19:59:46 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Mobile web]]></category>
		<category><![CDATA[Mosembro]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=275</guid>
		<description><![CDATA[The first major Mosembro release after r2 is now available for download.
If you already have Mosembro installed, uninstall it first by running: adb uninstall com.lexandera.mosembro
The new version can then be installed by executing the following command: adb install mosembro-r2.apk
New features include:

It is now possible to install addidional actions which extend Mosembro&#8217;s functionality.
Addresses can be copied [...]]]></description>
			<content:encoded><![CDATA[<p>The first major <a href="/mosembro/">Mosembro</a> release after r2 is now <a href="http://code.google.com/p/mosembro/downloads/list">available for download</a>.</p>
<p>If you already have Mosembro installed, uninstall it first by running: adb uninstall com.lexandera.mosembro<br />
The new version can then be installed by executing the following command: adb install mosembro-r2.apk</p>
<p>New features include:</p>
<ul>
<li>It is now possible to install addidional actions which extend Mosembro&#8217;s functionality.</li>
<li>Addresses can be copied to clipboard.</li>
<li>Improved security and various bugfixes.</li>
</ul>
<p>Screenshots of new features:</p>
<div id="attachment_277" class="wp-caption alignnone" style="width: 610px"><img class="size-full wp-image-277" title="Mosmbro r5 screenshots" src="http://lexandera.com/wp-content/uploads/2009/02/r5screenshots.png" alt="Mosmbro r5 screenshots" width="600" height="289" /><p class="wp-caption-text">Mosembro r5: dialogs for installing and managing installed actions</p></div>
<p>Several simple actions can be installed from the bottom of the <a href="http://lexandera.com/mosembrodemo/">demo page</a> which is loaded when Mosembro starts up. Go &amp; try them out.</p>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/02/mosembro-r5-now-available-for-download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intercepting page loads in WebView</title>
		<link>http://lexandera.com/2009/02/intercepting-page-loads-in-webview/</link>
		<comments>http://lexandera.com/2009/02/intercepting-page-loads-in-webview/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 05:20:38 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[WebView examples]]></category>
		<category><![CDATA[WebView]]></category>
		<category><![CDATA[WebViewClient]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=213</guid>
		<description><![CDATA[It is time for another WebView example. This time on how you can intercept any attempts at loading a web page and redirect the user to a different URL instead.
This can be achieved simply by registering a WebViewClient which overrides the shouldOverrideUrlLoading() method in which you tell the WebView to load a different URL from [...]]]></description>
			<content:encoded><![CDATA[<p>It is time for another <a href="http://code.google.com/android/reference/android/webkit/WebView.html">WebView</a> example. This time on how you can intercept any attempts at loading a web page and redirect the user to a different URL instead.</p>
<p>This can be achieved simply by registering a <a href="http://code.google.com/android/reference/android/webkit/WebViewClient.html">WebViewClient</a> which overrides the <a href="http://code.google.com/android/reference/android/webkit/WebViewClient.html#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)">shouldOverrideUrlLoading</a>() method in which you tell the WebView to load a different URL from the one the user had requested.</p>
<p>The example below loads lexandera.com first, but when the user clicks any link on the page, he is redirected to yahoo.com:</p>
<pre name="code" class="java">

WebView browser = (WebView)findViewById(R.id.browser);
browser.setWebViewClient(new WebViewClient() {
    /* On Android 1.1 shouldOverrideUrlLoading() will be called every time the user clicks a link,
     * but on Android 1.5 it will be called for every page load, even if it was caused by calling loadUrl()! */
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url)
    {
        /* intercept all page load attempts and load yahoo.com instead */
        String myAlternativeURL = &quot;http://yahoo.com&quot;;
        if (!url.equals(myAlternativeURL)) {
            view.loadUrl(myAlternativeURL);
            return true;
        }

        return false;
    }
});

browser.loadUrl(&quot;http://lexandera.com/&quot;);
</pre>
<p><del datetime="2009-08-25T05:42:59+00:00">Please note that calling <a href="http://code.google.com/android/reference/android/webkit/WebView.html#loadUrl(java.lang.String)">loadUrl</a>() does not trigger the shouldOverrideUrlLoading() method, which means that we do not need to worry about endless recursion when calling loadUrl() from within shouldOverrideUrlLoading()! </del></p>
<p><strong>UPDATE</strong>: The above statement is no longer true for Android 1.5! Calling <a href="http://code.google.com/android/reference/android/webkit/WebView.html#loadUrl(java.lang.String)">loadUrl</a>() will now also trigger the shouldOverrideUrlLoading() method! This means that you need to make sure that you are not creating an infinite loop when calling loadUrl() from shouldOverrideUrlLoading()!</p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/ed91eca5-2c5e-4b86-8b88-8af5a1b703f7/" title="Zemified by Zemanta"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=ed91eca5-2c5e-4b86-8b88-8af5a1b703f7" alt="Reblog this post [with Zemanta]"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/02/intercepting-page-loads-in-webview/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Extracting HTML from a WebView</title>
		<link>http://lexandera.com/2009/01/extracting-html-from-a-webview/</link>
		<comments>http://lexandera.com/2009/01/extracting-html-from-a-webview/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 19:30:33 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Semantic Web]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[WebView examples]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebView]]></category>
		<category><![CDATA[WebViewClient]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=200</guid>
		<description><![CDATA[Here&#8217;s another Android WebView tutorial for those of you who are looking for a way to get the source code of a page loaded in a WebView instance.
This example is a bit more complicated than previous ones, so let me explain it step by step:

First, a class called MyJavaScriptInterface is defined. It implements a single [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s another Android <a href="http://code.google.com/android/reference/android/webkit/WebView.html">WebView</a> tutorial for those of you who are looking for a way to get the source code of a page loaded in a WebView instance.</p>
<p>This example is a bit more complicated than previous ones, so let me explain it step by step:</p>
<ul>
<li>First, a class called MyJavaScriptInterface is defined. It implements a single public method showHTML() which displays a dialog with the HTML it receives as a parameter.</li>
<li>Then, an instance of this class is registered as a JavaScript interface called HTMLOUT. The showHTML() method can now be accessed from JavaScript like this: window.HTMLOUT.showHTML(&#8216;&#8230;&#8217;) </li>
<li>In order to call showHTML() when the page finishes loading, a <a href="http://code.google.com/android/reference/android/webkit/WebViewClient.html">WebViewClient</a> instance which overrides <a href="http://code.google.com/android/reference/android/webkit/WebViewClient.html#onPageFinished%28android.webkit.WebView,%20java.lang.String%29">onPageFinished</a>() is added to the WebView. When the page finises loading, this method will inject a piece of JavaScript code into the page, using <a href="http://lexandera.com/2009/01/injecting-javascript-into-a-webview/">the method I described in an earlier post</a>.</li>
<li>Finally, a web page is loaded.</li>
</ul>
<pre name="code" class="java">

final Context myApp = this;

/* An instance of this class will be registered as a JavaScript interface */
class MyJavaScriptInterface
{
    @SuppressWarnings(&quot;unused&quot;)
    public void showHTML(String html)
    {
        new AlertDialog.Builder(myApp)
            .setTitle(&quot;HTML&quot;)
            .setMessage(html)
            .setPositiveButton(android.R.string.ok, null)
        .setCancelable(false)
        .create()
        .show();
    }
}

final WebView browser = (WebView)findViewById(R.id.browser);
/* JavaScript must be enabled if you want it to work, obviously */
browser.getSettings().setJavaScriptEnabled(true);

/* Register a new JavaScript interface called HTMLOUT */
browser.addJavascriptInterface(new MyJavaScriptInterface(), &quot;HTMLOUT&quot;);

/* WebViewClient must be set BEFORE calling loadUrl! */
browser.setWebViewClient(new WebViewClient() {
    @Override
    public void onPageFinished(WebView view, String url)
    {
        /* This call inject JavaScript into the page which just finished loading. */
        browser.loadUrl(&quot;javascript:window.HTMLOUT.showHTML(&#039;&lt;head&gt;&#039;+document.getElementsByTagName(&#039;html&#039;)[0].innerHTML+&#039;&lt;/head&gt;&#039;);&quot;);
    }
});

/* load a web page */
browser.loadUrl(&quot;http://lexandera.com/files/jsexamples/gethtml.html&quot;);
</pre>
<p><strong>WARNING</strong><br />
Unfortunately, this approach suffers from a major security hole: if your JavaScript can call showHTML(), then so can JavaScript from every other page that might get loaded into the WebView. Use with care.</p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/bb22593d-ec9d-4064-9842-2bcb7fae4d4f/" title="Zemified by Zemanta"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=bb22593d-ec9d-4064-9842-2bcb7fae4d4f" alt="Reblog this post [with Zemanta]"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/01/extracting-html-from-a-webview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mosembro r2 now available for download</title>
		<link>http://lexandera.com/2009/01/mosembro-r2-now-available-for-download/</link>
		<comments>http://lexandera.com/2009/01/mosembro-r2-now-available-for-download/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 02:45:12 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Mobile web]]></category>
		<category><![CDATA[Mosembro]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=204</guid>
		<description><![CDATA[The second release of Mosembro is now available for download.
If you already have Mosembro installed, uninstall it first by running: adb uninstall com.lexandera.mosembro
The new version can then be installed by executing the following command: adb install mosembro-r2.apk
Major changes from r1:

Multiple actions can now be attached to a single link.
Microformat parsing logic was separated from action [...]]]></description>
			<content:encoded><![CDATA[<p>The second release of <a href="/mosembro/">Mosembro</a> is now <a href="http://code.google.com/p/mosembro/downloads/list">available for download</a>.</p>
<p>If you already have Mosembro installed, uninstall it first by running: <em>adb uninstall com.lexandera.mosembro</em><br />
The new version can then be installed by executing the following command: <em>adb install mosembro-r2.apk</em></p>
<p>Major changes from r1:</p>
<ul>
<li>Multiple actions can now be attached to a single link.</li>
<li>Microformat parsing logic was separated from action logic. Each microformat is parsed only once now and parsed data is then passed to one or more actions registered to handle that microformat.</li>
<li>Two new &#8220;travel to&#8230;&#8221; actions were added for addresses. One uses <a href="http://journeyplanner.tfl.gov.uk/user/XSLT_TRIP_REQUEST2?language=en">London Journey Planner</a> and the other one uses <a href="http://tripplanner.transit.511.org/mtc/XSLT_TRIP_REQUEST2?language=en&amp;itdLPxx_homepage=secondStep">Bay Area Trip Planner</a></li>
<li>alert(), confirm() and prompt() JavaScript functions now work.</li>
</ul>
<p>Here is an example screenshot of multiple actions on one link:</p>
<div id="attachment_209" class="wp-caption alignnone" style="width: 330px"><img class="size-full wp-image-209" title="Multiple actions for one link" src="http://lexandera.com/wp-content/uploads/2009/01/mutliple_actions.png" alt="Multiple actions for one link" width="320" height="370" /><p class="wp-caption-text">Multiple actions attached to one link</p></div>
<p>More screenshots and/or a video should be available in a couple of days.</p>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/01/mosembro-r2-now-available-for-download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding alert() support to a WebView</title>
		<link>http://lexandera.com/2009/01/adding-alert-support-to-a-webview/</link>
		<comments>http://lexandera.com/2009/01/adding-alert-support-to-a-webview/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 20:54:09 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebView examples]]></category>
		<category><![CDATA[WebChromeClient]]></category>
		<category><![CDATA[WebView]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=191</guid>
		<description><![CDATA[As promised earlier, here is an example of how to add support for alert() function to a WebView in your Android application:


final WebView browser = (WebView)findViewById(R.id.browser);
/* JavaScript must be enabled if you want it to work, obviously */
browser.getSettings().setJavaScriptEnabled(true);

final Context myApp = this;

/* WebChromeClient must be set BEFORE calling loadUrl! */
browser.setWebChromeClient(new WebChromeClient() {
    [...]]]></description>
			<content:encoded><![CDATA[<p>As promised earlier, here is an example of how to add support for alert() function to a WebView in your <a class="zem_slink" href="http://code.google.com/android/" title="Android" rel="homepage">Android</a> application:</p>
<pre name="code" class="java">

final WebView browser = (WebView)findViewById(R.id.browser);
/* JavaScript must be enabled if you want it to work, obviously */
browser.getSettings().setJavaScriptEnabled(true);

final Context myApp = this;

/* WebChromeClient must be set BEFORE calling loadUrl! */
browser.setWebChromeClient(new WebChromeClient() {
    @Override
    public boolean onJsAlert(WebView view, String url, String message, final android.webkit.JsResult result)
    {
        new AlertDialog.Builder(myApp)
            .setTitle(&quot;javaScript dialog&quot;)
            .setMessage(message)
            .setPositiveButton(android.R.string.ok,
                    new AlertDialog.OnClickListener()
                    {
                        public void onClick(DialogInterface dialog, int which)
                        {
                            result.confirm();
                        }
                    })
            .setCancelable(false)
            .create()
            .show();

        return true;
    };
});

/* load a web page which uses the alert() function */
browser.loadUrl(&quot;http://lexandera.com/files/jsexamples/alert.html&quot;);
</pre>
<p>Code for adding support for confirm() and prompt() is almost identical and can be found in <a href="http://code.google.com/p/mosembro/source/browse/trunk/src/com/lexandera/mosembro/Mosembro.java?spec=svn12&amp;r=12#137">Mosembro&#8217;s source code</a>. </p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/62e34ae6-3382-45cb-b4f5-f08a367c4a80/" title="Zemified by Zemanta"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=62e34ae6-3382-45cb-b4f5-f08a367c4a80" alt="Reblog this post [with Zemanta]"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/01/adding-alert-support-to-a-webview/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Android WebChromeClient</title>
		<link>http://lexandera.com/2009/01/android-webchromeclient/</link>
		<comments>http://lexandera.com/2009/01/android-webchromeclient/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 03:30:16 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[WebView examples]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[WebChromeClient]]></category>
		<category><![CDATA[WebView]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=179</guid>
		<description><![CDATA[My blog stats are telling me that many visitors are arriving here looking for examples on how to implement WebChromeClient on Android. I don&#8217;t (yet) have a nice article about how to do it, but you can have a look at how I implemented WebChromeClient in Mosembro, if you came here for that reason. Just [...]]]></description>
			<content:encoded><![CDATA[<p>My blog stats are telling me that many visitors are arriving here looking for examples on how to implement <a href="http://code.google.com/android/reference/android/webkit/WebChromeClient.html">WebChromeClient</a> on <a class="zem_slink" title="Android" rel="homepage" href="http://code.google.com/android/">Android</a>. I don&#8217;t (yet) have a nice article about how to do it, but you can <a href="http://code.google.com/p/mosembro/source/browse/trunk/src/com/lexandera/mosembro/Mosembro.java">have a look at how I implemented WebChromeClient in Mosembro</a>, if you came here for that reason. Just use your browser&#8217;s search functionality and look for &#8220;new WebChromeClient&#8221;.</p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/b89819f7-2769-4fb9-91f8-ab40a0b3e67b/" title="Zemified by Zemanta"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=b89819f7-2769-4fb9-91f8-ab40a0b3e67b" alt="Reblog this post [with Zemanta]"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/01/android-webchromeclient/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mosembro status update</title>
		<link>http://lexandera.com/2009/01/mosembro-status-update/</link>
		<comments>http://lexandera.com/2009/01/mosembro-status-update/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 00:24:48 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Mosembro]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=155</guid>
		<description><![CDATA[First of all, I would like to thank everyone who helped promote Mosembro by posting about it on their blogs and on Twitter. And also a big thank you to everyone who sent me feedback. Your suggestions will help me a lot during future development.
Speaking of which&#8230;
I performed some major surgery on Mosembro&#8217;s internals this [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, I would like to thank everyone who helped promote <a href="/mosembro/">Mosembro</a> by posting about it on their blogs and on Twitter. And also a big thank you to everyone who sent me feedback. Your suggestions will help me a lot during future development.</p>
<p>Speaking of which&#8230;</p>
<p>I performed some major surgery on Mosembro&#8217;s internals this past weekend. Scripts don&#8217;t do their own parsing of microformats anymore; instead, there are now dedicated parsers for each of the supported microformats. These parsers then call any scripts which might be registered to handle that particular microformat. This gets us closer to being able to implement support for installing third party scripts. It will also make it possible to attach multiple actions to a single event/address/etc., as shown on this mock-up:</p>
<p><img class="alignnone size-full wp-image-150" title="multiaction2" src="http://lexandera.com/wp-content/uploads/2009/01/multiaction2.png" alt="multiaction2" width="454" height="222" /></p>
<p>Considering how small the codebase of Mosembro is, this shouldn&#8217;t take long to implement. Expect a new release soon™.</p>
<p>Meanwhile, if you have any suggestions, I&#8217;d be more than happy to read them.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/a43c6f5d-c347-42ca-99b4-738e1d26f104/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=a43c6f5d-c347-42ca-99b4-738e1d26f104" alt="Reblog this post [with Zemanta]" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/01/mosembro-status-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Mosembro</title>
		<link>http://lexandera.com/2009/01/introducing-mosembro/</link>
		<comments>http://lexandera.com/2009/01/introducing-mosembro/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 05:44:32 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Mosembro]]></category>
		<category><![CDATA[Semantic Web]]></category>
		<category><![CDATA[Microformat]]></category>
		<category><![CDATA[Proof of concept]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[user interface]]></category>
		<category><![CDATA[Web browser]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=94</guid>
		<description><![CDATA[
Mosembro, short for &#8220;mobile semantic browser&#8221;, is a proof-of-concept web browser for the Android mobile platform, which has integrated support for microformats. It was my entry for the Android developer challenge (but was called SmartBrowser back then), and while it wasn&#8217;t one of the 50 finalists who made it to the second round, it did [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lexandera.com/mosembro"><img class="alignnone size-full wp-image-95" title="Mosembro logo" src="http://lexandera.com/wp-content/uploads/2009/01/mosembro-logo.png" alt="Mosembro logo" width="260" height="49" /></a></p>
<p>Mosembro, short for &#8220;mobile semantic browser&#8221;, is a proof-of-concept web browser for the <a class="zem_slink" title="Android" rel="homepage" href="http://code.google.com/android/">Android</a> mobile platform, which has integrated support for <a class="zem_slink" title="Microformat" rel="wikipedia" href="http://en.wikipedia.org/wiki/Microformat">microformats</a>. It was my entry for the Android developer challenge (but was called SmartBrowser back then), and while it wasn&#8217;t one of the 50 finalists who made it to the second round, it did finish in the top 25% of all entries, which is pretty good, I suppose.</p>
<p>The goal of this project is very simple: to make a better mobile browser with the help of embedded semantic metadata.</p>
<p>What does it do? It scans any loaded web page for microformats and inserts special links into it, based on any microformats it may have found. These links then enable the user to quickly perform tasks like looking up an address on a map or adding an event to his calendar. While manually performing these tasks is very simple on a computer, it can be pretty tedious on a mobile device without a proper keyboard, mouse, or even without the ability to copy and paste text.</p>
<p>Full feature list, demo videos, downloads and source code are available at the <a href="/mosembro/">Mosembro project page</a>.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/5e1d55c4-4b63-435b-bec0-d87eb594abf6/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=5e1d55c4-4b63-435b-bec0-d87eb594abf6" alt="Reblog this post [with Zemanta]" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/01/introducing-mosembro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Injecting JavaScript into a WebView</title>
		<link>http://lexandera.com/2009/01/injecting-javascript-into-a-webview/</link>
		<comments>http://lexandera.com/2009/01/injecting-javascript-into-a-webview/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 06:05:21 +0000</pubDate>
		<dc:creator>Aleksander Kmetec</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebView examples]]></category>
		<category><![CDATA[WebChromeClient]]></category>
		<category><![CDATA[WebView]]></category>
		<category><![CDATA[WebViewClient]]></category>

		<guid isPermaLink="false">http://lexandera.com/?p=64</guid>
		<description><![CDATA[Back in early &#8216;08, while the Androd developer challenge was in full swing, a fairly common question which went without a satisfactory answer was: &#8220;How can I manipulate the contents of a WebView?&#8221;. I now finally have the answer, thanks to a couple of lines of code I stumbled upon while looking at the source [...]]]></description>
			<content:encoded><![CDATA[<p>Back in early &#8216;08, while the <a href="http://code.google.com/android/adc.html">Androd developer challenge</a> was in full swing, a fairly common question which went without a satisfactory answer was: &#8220;How can I manipulate the contents of a WebView?&#8221;. I now finally have the answer, thanks to a couple of lines of code I stumbled upon while looking at the source of <a href="http://www.jsharkey.org/" title="Jeffrey Sharkey" rel="homepage" class="zem_slink">Jeffrey Sharkey</a>&#8217;s <a href="http://www.jsharkey.org/blog/2008/12/15/oilcan-greasemonkey-on-steroids-for-android/">OilCan</a>.</p>
<p>The solution is actually very simple: wait for the original page to finish loading, then inject your own JavaScript code into it by calling webview.loadUrl(&#8220;javascript:your-code-here&#8221;) when your webvew&#8217;s onPageFinished() event is triggered. Loading an URL beginning with &#8220;javascript:&#8221; is the exact same approach used by <a href="http://en.wikipedia.org/wiki/Bookmarklet" title="Bookmarklet" rel="wikipedia" class="zem_slink">bookmarklets</a>.</p>
<p>Here&#8217;s a simple example which loads a page and then sets its text color to red:</p>
<pre name="code" class="java">

final WebView webview = (WebView)findViewById(R.id.browser);
/* JavaScript must be enabled if you want it to work, obviously */
webview.getSettings().setJavaScriptEnabled(true);

/* WebViewClient must be set BEFORE calling loadUrl! */
webview.setWebViewClient(new WebViewClient() {
    @Override
    public void onPageFinished(WebView view, String url)
    {
        webview.loadUrl(&quot;javascript:(function() { &quot; +
                &quot;document.getElementsByTagName(&#039;body&#039;)[0].style.color = &#039;red&#039;; &quot; +
                &quot;})()&quot;);
    }
});

webview.loadUrl(&quot;http://code.google.com/android&quot;);
</pre>
<p>That&#8217;s it.</p>
<p>Please note though that <em>alert()</em> and <em>confirm()</em> JavaScript functions will not work unless you also register a <a href="http://code.google.com/android/reference/android/webkit/WebChromeClient.html">WebChromeClient</a> which implements the required methods.</p>
<div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/75a6582e-c459-4c4e-848b-e48a050ab4c9/" title="Zemified by Zemanta"><img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=75a6582e-c459-4c4e-848b-e48a050ab4c9" alt="Reblog this post [with Zemanta]"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://lexandera.com/2009/01/injecting-javascript-into-a-webview/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
