<?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>olex.biz &#187; android</title>
	<atom:link href="http://olex.biz/category/blog/software/android/feed/" rel="self" type="application/rss+xml" />
	<link>http://olex.biz</link>
	<description>Website of a computer science student and a generally good man</description>
	<lastBuildDate>Wed, 27 Jul 2011 13:23:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Android: scroll a ListView with volume keys</title>
		<link>http://olex.biz/android/scroll-listview-with-volume-keys/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=scroll-listview-with-volume-keys</link>
		<comments>http://olex.biz/android/scroll-listview-with-volume-keys/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 23:47:06 +0000</pubDate>
		<dc:creator>Olexandr Savchuk</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://olex.biz/?p=255</guid>
		<description><![CDATA[Basically, what you need to do is to override the <code>dispatchKeyEvent()</code> method in your Activity, and intercept key presses for the volume keys, leaving the other keys untouched. This is how I did it, fairly straightforward...]]></description>
			<content:encoded><![CDATA[<p>Scrolling a list view in an Android app using the volume buttons on the side of the phone is actually quite easy. Not knowing this, yesterday I spent some time looking for a nice easy tutorial to do this, and found nothing. Having it coded and released in version 1.0 of <a href="http://olex.biz/android/quoter">Quoter</a>, I thought it&#8217;d be a good thing to write one myself.</p>
<p>Basically, what you need to do is to override the <code>dispatchKeyEvent()</code> method in your Activity, and intercept key presses for the volume keys, leaving the other keys untouched. This is how I did it, fairly straightforward:</p>
<pre name="code" class="java">@Override
public boolean dispatchKeyEvent(KeyEvent event) {
	if (event.getAction() == KeyEvent.ACTION_DOWN) {
		switch (event.getKeyCode()) {
		case KeyEvent.KEYCODE_VOLUME_UP:
			scrollToPrevious();
			return true;
		case KeyEvent.KEYCODE_VOLUME_DOWN:
			scrollToNext();
			return true;
		}
	}
	if (event.getAction() == KeyEvent.ACTION_UP
		&#038;&#038; (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP
			|| event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN)) {
		return true;
	}
	return super.dispatchKeyEvent(event);
}</pre>
<p>Note that we only execute our code on the <code>ACTION_DOWN</code> event &#8211; the <code>ACTION_UP</code> event is only caught in order to mute the keypress sound. Then <code>event.getKeyCode()</code> is checked, and if the key pressed is volume up or volume down, my scrolling functions are called and the function returns. In any other case (another event or different keys) the execution is passed on to the standard key press handler.</p>
<p>Next are the scrolling functions to scroll the <code>ListView</code>. The problem with these is, you can scroll to any x/y coordinates using the <code>scrollTo</code> method. But what I needed is to scroll to the next visible item, since Quoter is a reading app and one wants to scroll to the next qoute in the list and read it. So this is what I did:</p>
<pre name="code" class="java">private void scrollToNext() {
	int currentPosition = getListView().getFirstVisiblePosition();
	if (currentPosition == getListView().getCount() - 1)
		return;
	getListView().setSelection(currentPosition + 1);
	getListView().clearFocus();
}

private void scrollToPrevious() {
	int currentPosition = getListView().getFirstVisiblePosition();
	if (currentPosition == 0)
		return;
	getListView().setSelection(currentPosition - 1);
	getListView().clearFocus();
}</pre>
<p>First we get the list position of the first element visible on screen. If it&#8217;s already the last position in scroll direction, we do nothing. If it isn&#8217;t, we set the selection in the list to the next item; this automatically scrolls the list (same thing happens if you use the D-pad keys to navigate a list). The only problem now is, the list item becomes selected and highlighted, which we don&#8217;t want since we&#8217;re reading text from it. By clearing the focus from the list, we remove the selection. All done.</p>
<div class="bottomcontainerBox" style="">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Folex.biz%2Fandroid%2Fscroll-listview-with-volume-keys%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://olex.biz/android/scroll-listview-with-volume-keys/"></g:plusone>
			</div>
			<div style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://olex.biz/android/scroll-listview-with-volume-keys/"  data-text="Android: scroll a ListView with volume keys" data-count="horizontal" data-via="olex">Tweet</a>
			</div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://olex.biz/android/scroll-listview-with-volume-keys/feed/langswitch_lang/en/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Android App &#8211; Quoter</title>
		<link>http://olex.biz/android/quoter/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quoter</link>
		<comments>http://olex.biz/android/quoter/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 10:01:24 +0000</pubDate>
		<dc:creator>Olexandr Savchuk</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://olex.biz/?p=202</guid>
		<description><![CDATA[Android Market: Quoter Read fun internet quotes from a variety of websites. Perfect entertaining while waiting in queues, public transport and similar. Features include: - Choosing which sites to read from - Reading latest quotes - Saving quotes for offline reading - Sharing quotes via SMS, email, Facebook etc. If you like my app, please [...]]]></description>
			<content:encoded><![CDATA[<p>
<div class="pie-gallery alignGalleryLeft">
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh6.ggpht.com/_fCjhR7xUM2U/TWZBbcFiUAI/AAAAAAAACSU/V8u04q4kGFk/quoter-1.0-0.jpg?imgmax=800" rel="lightbox[2011-1-4-12-33-49]"><img src="http://lh6.ggpht.com/_fCjhR7xUM2U/TWZBbcFiUAI/AAAAAAAACSU/V8u04q4kGFk/quoter-1.0-0.jpg?imgmax=144" alt="quoter-1.0-0.jpg" width="86" height="144" class="pie-img"/></a></p>
</div>
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh4.ggpht.com/_fCjhR7xUM2U/TWZBZuZrA1I/AAAAAAAACSE/qW8NXYUgkWY/quoter-1.0-2.jpg?imgmax=800" rel="lightbox[2011-1-4-12-33-49]"><img src="http://lh4.ggpht.com/_fCjhR7xUM2U/TWZBZuZrA1I/AAAAAAAACSE/qW8NXYUgkWY/quoter-1.0-2.jpg?imgmax=144" alt="quoter-1.0-2.jpg" width="86" height="144" class="pie-img"/></a></p>
</div>
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh4.ggpht.com/_fCjhR7xUM2U/TWZBaXFMt-I/AAAAAAAACSI/otjhz2Midqk/quoter-1.0-3.jpg?imgmax=800" rel="lightbox[2011-1-4-12-33-49]"><img src="http://lh4.ggpht.com/_fCjhR7xUM2U/TWZBaXFMt-I/AAAAAAAACSI/otjhz2Midqk/quoter-1.0-3.jpg?imgmax=144" alt="quoter-1.0-3.jpg" width="86" height="144" class="pie-img"/></a></p>
</div>
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh6.ggpht.com/_fCjhR7xUM2U/TWZBZZ06llI/AAAAAAAACSA/RW7xu4088Dc/quoter-1.0-1.jpg?imgmax=800" rel="lightbox[2011-1-4-12-33-49]"><img src="http://lh6.ggpht.com/_fCjhR7xUM2U/TWZBZZ06llI/AAAAAAAACSA/RW7xu4088Dc/quoter-1.0-1.jpg?imgmax=144" alt="quoter-1.0-1.jpg" width="86" height="144" class="pie-img"/></a></p>
</div>
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh4.ggpht.com/_fCjhR7xUM2U/TWZBa7JGdII/AAAAAAAACSM/YQ62gNxl8XE/quoter-1.0-4.jpg?imgmax=800" rel="lightbox[2011-1-4-12-33-49]"><img src="http://lh4.ggpht.com/_fCjhR7xUM2U/TWZBa7JGdII/AAAAAAAACSM/YQ62gNxl8XE/quoter-1.0-4.jpg?imgmax=144" alt="quoter-1.0-4.jpg" width="86" height="144" class="pie-img"/></a></p>
</div>
</div>
<p><a href="https://market.android.com/details?id=biz.olex.android.quoter">Android Market: Quoter</a> <a href="http://olex.biz/wp-content/uploads/2010/03/qrcode-1.png"><img src="http://olex.biz/wp-content/uploads/2010/03/qrcode-1.png" alt="Quoter QR Code" title="qrcode-quoter-s" width="140" height="140" class="alignright size-full wp-image-206" /></a><br />
Read fun internet quotes from a variety of websites. Perfect entertaining while waiting in queues, public transport and similar.</p>
<p>Features include:<br />
- Choosing which sites to read from<br />
- Reading latest quotes<br />
- Saving quotes for offline reading<br />
- Sharing quotes via SMS, email, Facebook etc.</p>
<p>If you like my app, please buy the <a href="https://market.android.com/details?id=biz.olex.android.quoter.donate">donate version</a> &#8211; it&#8217;s ad-free!</p>
<p>Any comments and suggestions are welcome here in the Market or per eMail.</p>
<p>Quote sources in English:<br />
- bash.org: latest, random, random >0, top100<br />
- qdb.us<br />
- quotebucket.org<br />
- fmylife.com</p>
<p>Quote sources in German:<br />
- german-bash.org: latest, random<br />
- ibash.de<br />
- swissbash.ch<br />
- abash.at<br />
- SMSvonGesternNacht<br />
- school-bash.org</p>
<p>Quote sources in Russian and Ukrainian:<br />
- bash.org.ru: latest, random, abyss, abyssbest, all with pagination support!<br />
- ibash.org.ru<br />
- ithappens.ru<br />
- zadolba.li<br />
- bash.bynets.org (bash.org.by)<br />
- ukrbash.org<br />
- killmepls.ru<br />
- nefart.ru</p>
<div class="bottomcontainerBox" style="">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Folex.biz%2Fandroid%2Fquoter%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://olex.biz/android/quoter/"></g:plusone>
			</div>
			<div style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://olex.biz/android/quoter/"  data-text="Android App &#8211; Quoter" data-count="horizontal" data-via="olex">Tweet</a>
			</div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://olex.biz/android/quoter/feed/langswitch_lang/en/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Android App: Darmstadt student canteens</title>
		<link>http://olex.biz/blog/android-mensa/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=android-mensa</link>
		<comments>http://olex.biz/blog/android-mensa/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 21:34:30 +0000</pubDate>
		<dc:creator>Olexandr Savchuk</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://olex.biz/?p=149</guid>
		<description><![CDATA[So I&#8217;ve got myself a new and shiny HTC Magic as a replacement for the old and dying Touch. And then I thought: hmm, Android is an open platform, and apps are natively written in Java. I know Java. Why not try to write something? A good idea soon came from a friend: a client [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve got myself a new and shiny HTC Magic as a replacement for the old and dying Touch. And then I thought: hmm, Android is an open platform, and apps are natively written in Java. I know Java. Why not try to write something?</p>
<p>A good idea soon came from a friend: a client for the menu of the Mensa, university&#8217;s cafeteria of sorts. So one can look, while walking from the lectures (or sitting in them), what there is to eat today, and whether one doesn&#8217;t rather want to walk straight home. And so, a day, lots of coffee and a lot of googling later, I present you this wonderous Android app to see and download:</p>
<p>
<div class="pie-gallery alignGalleryLeft">
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh6.ggpht.com/_fCjhR7xUM2U/Su38nCrEQDI/AAAAAAAABgM/s25WYAzN0UA/mensa-screen1.jpg?imgmax=800" rel="lightbox[2009-10-0-22-33-7]"><img src="http://lh6.ggpht.com/_fCjhR7xUM2U/Su38nCrEQDI/AAAAAAAABgM/s25WYAzN0UA/mensa-screen1.jpg?imgmax=144" alt="mensa-screen1.jpg" width="95" height="144" class="pie-img"/></a></p>
</div>
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh3.ggpht.com/_fCjhR7xUM2U/Su38nencqNI/AAAAAAAABgQ/v2cwtCOsvPY/screen2.jpg?imgmax=800" rel="lightbox[2009-10-0-22-33-7]"><img src="http://lh3.ggpht.com/_fCjhR7xUM2U/Su38nencqNI/AAAAAAAABgQ/v2cwtCOsvPY/screen2.jpg?imgmax=144" alt="screen2.jpg" width="96" height="144" class="pie-img"/></a></p>
</div>
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh5.ggpht.com/_fCjhR7xUM2U/Su38nceeb5I/AAAAAAAABgU/eFUODEy6RZo/screen3.jpg?imgmax=800" rel="lightbox[2009-10-0-22-33-7]"><img src="http://lh5.ggpht.com/_fCjhR7xUM2U/Su38nceeb5I/AAAAAAAABgU/eFUODEy6RZo/screen3.jpg?imgmax=144" alt="screen3.jpg" width="96" height="144" class="pie-img"/></a></p>
</div>
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh3.ggpht.com/_fCjhR7xUM2U/Su38nke_1UI/AAAAAAAABgY/CYEVKBEMmhw/screen5.jpg?imgmax=800" rel="lightbox[2009-10-0-22-33-7]"><img src="http://lh3.ggpht.com/_fCjhR7xUM2U/Su38nke_1UI/AAAAAAAABgY/CYEVKBEMmhw/screen5.jpg?imgmax=144" alt="screen5.jpg" width="95" height="144" class="pie-img"/></a></p>
</div>
<div class="pie-item" style="margin:3px 3px 0px 0px;">
<p class="pie-img-wrapper"><a href="http://lh5.ggpht.com/_fCjhR7xUM2U/Su3-gUemWhI/AAAAAAAABgc/GrtPEhZGH-w/screen1.jpg?imgmax=800" rel="lightbox[2009-10-0-22-33-7]"><img src="http://lh5.ggpht.com/_fCjhR7xUM2U/Su3-gUemWhI/AAAAAAAABgc/GrtPEhZGH-w/screen1.jpg?imgmax=144" alt="screen1.jpg" width="96" height="144" class="pie-img"/></a></p>
</div>
</div>
<p><!--<br />
The app is not on the market, since I can't be bothered to put it there. And at the install it says it wants access to your phone status and SD card data: I assure you it is the app's own will, I did not make it do that. The permission to use internet connection is intended, obviously, but that's all it does.--></p>
<p>The app is available from the Android Market, and can be found easiest by scanning the following QR Code (if you don&#8217;t have the Barcode Scanner app, go and install it from the Market now, it&#8217;s a must on Android):<br />
<img src="http://stuff.olex.biz/mensa-qr.png" alt="QR Code: Mensen Darmstadt" /></p>
<div class="bottomcontainerBox" style="">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Folex.biz%2Fblog%2Fandroid-mensa%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://olex.biz/blog/android-mensa/"></g:plusone>
			</div>
			<div style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://olex.biz/blog/android-mensa/"  data-text="Android App: Darmstadt student canteens" data-count="horizontal" data-via="olex">Tweet</a>
			</div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://olex.biz/blog/android-mensa/feed/langswitch_lang/en/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

