<?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>htmlpress.net</title>
	<atom:link href="http://htmlpress.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://htmlpress.net</link>
	<description>Android tutorial, WordPress tutorial, and HTML 5 tutorial :: We&#039;re teaching the web.</description>
	<lastBuildDate>Mon, 10 Jun 2013 00:07:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How To Make Your Android Layout Scroll</title>
		<link>http://htmlpress.net/how-to-make-your-android-layout-scroll/</link>
		<comments>http://htmlpress.net/how-to-make-your-android-layout-scroll/#comments</comments>
		<pubDate>Mon, 10 Jun 2013 00:06:02 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[android tutorial]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17382</guid>
		<description><![CDATA[Placing a scrollable layout is one of the most easiest thing to do in Android. Usually when developers create a simple app most would use the layout view and test on an Android Virtual Device. However, some things are missed when used in a real device. And usually, when it comes to layouts, it&#8217;s the [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p>Placing a scrollable layout is one of the most easiest thing to do in Android. Usually when developers create a simple app most would use the layout view and test on an Android Virtual Device. However, some things are missed when used in a real device. And usually, when it comes to layouts, it&#8217;s the scroll functionality.</p>
<p>So here&#8217;s how to put a scrollable feature when you have started your app with a Layout View. Take the example below:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/hello&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnWords&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/words&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnTones&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/tones&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnGestures&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/gestures&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnPostures&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/postures&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnFacial&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/facial&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnWalk&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/walk&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/drivers&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>    
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnHistrionic&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/adaptation.histrionic&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnObsessive&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/adaptation.obsessive&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnParanoid&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/adaptation.paranoid&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnSchizoid&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/adaptation.schizoid&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnPassive&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/adaptation.passive&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>    
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/btnAntisocial&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;match_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/adaptation.antisocial&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>      
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Because the buttons are just too many, it may be too obvious that when it comes to small devices, the user will not be able to see the whole layout. To get around this just add the following:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ScrollView</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">   <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span> <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/hello&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
&quot;
&quot;
&quot;
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ScrollView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>It&#8217;s just a matter of adding a ScrollView tag and terminating it with one too.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/how-to-make-your-android-layout-scroll/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Test Your Android App On A Mobile Phone From Ubuntu</title>
		<link>http://htmlpress.net/how-to-test-your-android-app-on-a-mobile-phone-from-ubuntu/</link>
		<comments>http://htmlpress.net/how-to-test-your-android-app-on-a-mobile-phone-from-ubuntu/#comments</comments>
		<pubDate>Sun, 09 Jun 2013 23:24:09 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[android tutorial]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17376</guid>
		<description><![CDATA[Developing android apps on an Android Virtual Device is the most popular way to test your apps. AVD gives you the closes experience you can have in a virtual testing environment. However, nothing substitutes from the real thing. some might also find it easier to test on the actual device compared to the AVD. To [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p>Developing android apps on an Android Virtual Device is the most popular way to test your apps. AVD gives you the closes experience you can have in a virtual testing environment. However, nothing substitutes from the real thing. some might also find it easier to test on the actual device compared to the AVD.</p>
<p>To test your device on a Huawei U8180 mobile phone for example, just perform the following steps:</p>
<p>1. Connect your phone to your Ubuntu computer via USB<br />
2. On your mobile phone go to Settings | Applications<br />
3. Tick the <em>Unknown Sources</em> checkbox<br />
4. Select <em>Development</em> menu<br />
5. Tick the <em>USB debugging</em> checkbox<br />
6. In Ubuntu, open your Terminal window in Applications | Accessories | Terminal<br />
7. Type the command: lsusb<br />
8. You should see the following entry regarding Huawei. Take note of the ID.</p>
<p><code><br />
Bus 001 Device 006: ID 12d1:1038 Huawei Technologies Co., Ltd.<br />
</code></p>
<p>9. In Ubuntu&#8217;s Terminal window, create/edit the file:</p>
<p><code><br />
$ sudo gedit /etc/udev/rules.d/50-android.rules<br />
</code><br />
<em><br />
(If this doesn&#8217;t work, create/edit another file and name it 51-android.rules.<br />
Type the alternative content found on the next step.)</em></p>
<p>10. Write the following contents:</p>
<p><code><br />
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”12d1?, MODE=”0666?<br />
</code></p>
<p><em>(For the 51-android.rules file type:<br />
SUBSYSTEMS==&#8221;usb&#8221;, ATTRS{idVendor}==&#8221;12d1&#8243;, ATTRS{idProduct}==&#8221;1436&#8243;, MODE=&#8221;0666&#8243;)</em></p>
<p>11. Restart udev in the Terminal window with the following command:</p>
<p><code><br />
sudo restart udev<br />
</code></p>
<p>12. Restart the server in the Terminal window with the following commands:</p>
<p><code><br />
adb kill-server<br />
adb start-server<br />
</code></p>
<p>13. Check if your device is recognize by typing the command in the Terminal window:</p>
<p><code><br />
adb devices<br />
</code></p>
<p>14. The following information should appear:</p>
<p>List of devices attached<br />
1C1D6734216C	device</p>
<p>15. In Eclipse, when you run your program the following window will appear:</p>
<p><img src="http://htmlpress.net/wp-content/uploads/2013/06/Android-Device-Chooser-.png" /></p>
<p>16. If you receive an error regarding the API you are using, just <a href="http://htmlpress.net/how-to-change-the-api-level-of-an-android-project/" title="change api level in android">change the API Level</a> used in your project.</p>
<h3 class='related_post_title'>Related Posts:</h3><ul class='related_post'><li><a href='http://htmlpress.net/how-to-create-a-relative-layout-with-a-background-image/' title='How To Create A Relative Layout With A Background Image'>How To Create A Relative Layout With A Background Image</a></li><li><a href='http://htmlpress.net/programming-in-an-android-environment/' title='Programming In An Android Environment'>Programming In An Android Environment</a></li><li><a href='http://htmlpress.net/how-to-change-the-api-level-of-an-android-project/' title='How To Change The API Level Of An Android Project'>How To Change The API Level Of An Android Project</a></li><li><a href='http://htmlpress.net/how-to-have-a-vibrate-effect-in-your-application/' title='How To Have A Vibrate Effect In Your Application'>How To Have A Vibrate Effect In Your Application</a></li><li><a href='http://htmlpress.net/how-to-detect-data-connection-in-android/' title='How To Detect Data Connection In Android'>How To Detect Data Connection In Android</a></li></ul>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/how-to-test-your-android-app-on-a-mobile-phone-from-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Glass Is Coming</title>
		<link>http://htmlpress.net/google-glass-is-coming/</link>
		<comments>http://htmlpress.net/google-glass-is-coming/#comments</comments>
		<pubDate>Fri, 08 Mar 2013 05:51:06 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Glass]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17369</guid>
		<description><![CDATA[By now, almost every Android developer has hear about Google Glass. It&#8217;s a wearable computing device that is voice activated. This means that you do not need a mouse. If you watch the promo video, you&#8217;ll know how the device works. According to Google, the Glass can tether with and Android mobile or an iPhone. [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p><iframe width="560" height="315" src="http://www.youtube.com/embed/9c6W4CCU9M4" frameborder="0" allowfullscreen></iframe></p>
<p>By now, almost every Android developer has hear about Google Glass. It&#8217;s a wearable computing device that is voice activated. This means that you do not need a mouse. If you watch the promo video, you&#8217;ll know how the device works. According to Google, the Glass can tether with and Android mobile or an iPhone. And this only makes sense because you wouldn&#8217;t like cellular waves constantly bombarding your brain when you wear Google glass.</p>
<p>There are also reports that Google Glass can be programmed using Java/Android and will run on an android operating system. So soon we will be including tutorials on how to program with Google Glass. Because the future looks like HTML &#8211; Android apps &#8211; Google apps. HTML is the core of internet technology. In fact, HTML 5 is fast making in roads as the technology for mobile app creation. So it will not be surprising if Google  Glass heads this way too.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/google-glass-is-coming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redesigning Websites</title>
		<link>http://htmlpress.net/redesigning-websites/</link>
		<comments>http://htmlpress.net/redesigning-websites/#comments</comments>
		<pubDate>Mon, 21 Jan 2013 07:47:33 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17336</guid>
		<description><![CDATA[Redesigning websites is quite an undertaking. If you are a regular visitor to this site you would notice that a lot has change in the UI. And it wasn&#8217;t an easy decision. But in the end it boils down to three factors: KISS principle User Experience Adapting to changing tachnologies Keep It Simple I think [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p>Redesigning websites is quite an undertaking. If you are a regular visitor to this site you would notice that a lot has change in the UI. And it wasn&#8217;t an easy decision. But in the end it boils down to three factors:</p>
<ul>
<li>KISS principle</li>
<li>User Experience</li>
<li>Adapting to changing tachnologies</li>
</ul>
<p><strong>Keep It Simple</strong></p>
<p>I think this one is self explanatory. Although some may think it only applies to programming this principle actually applies to almost all aspects of life &#8211; including design. When talking about logos for example, the top brands have a very simple design. Maybe only a few have a logos that are elaborate. And I say maybe because as I think of some logos I couldn&#8217;t think of any brands with really complex and elaborate designs.</p>
<p><strong>User Experience</strong></p>
<p>In redesigning this website we want to make sure that the user experience improves. From the old design, you can see that there are quite a lot of items in there.</p>
<p><img src="http://htmlpress.net/wp-content/uploads/2013/01/htmlpress-amazing.png" width="550px"/></p>
<p>But with the new design we made sure that fonts are bigger and that there are more white spaces which hopefully makes it more pleasant to read a technical article.</p>
<p><img src="http://htmlpress.net/wp-content/uploads/2013/01/htmlpress-frank.png" width="550px" /></p>
<p><strong>Adapting to Technology</strong></p>
<p>One of the major factors that prompted us to change the website design is the ubiquitousness of smart phones and tablets. Having smaller screen sizes, it became essential to modify the pages in our website to accommodate such devices. Although desktop use is still there, it won&#8217;t be long before tablets will be the main gadget for surfing online &#8211; even at home. That&#8217;s because you can bring these devices in the living room, dining room, etc.</p>
<p>We switched from the Amazing Grace design to a theme called Frank. And quite frankly, it looks good to the eyes.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/redesigning-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Create A Relative Layout With A Background Image</title>
		<link>http://htmlpress.net/how-to-create-a-relative-layout-with-a-background-image/</link>
		<comments>http://htmlpress.net/how-to-create-a-relative-layout-with-a-background-image/#comments</comments>
		<pubDate>Thu, 03 Jan 2013 03:53:19 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[android tutorial]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17313</guid>
		<description><![CDATA[Most of the example in these Android tutorial use Linear Layout as it is the default layout. This type of layout has its advantages and disadvantages. If you would like to use a background image using a Linear Layout, you can use the attribute android:background to accomplish this. However, this attribute has its limitations. The [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p>Most of the example in these Android tutorial use Linear Layout as it is the default layout. This type of layout has its advantages and disadvantages. If you would like to use a background image using a Linear Layout, you can use the attribute <code>android:background</code> to accomplish this. However, this attribute has its limitations. The most common one is that the image being used stretches and can distort the image. To get around this, using a Relative Layout and Image View would be the best solution.</p>
<p>In a previous post, it describes <a href="http://htmlpress.net/basic-android-button-tutorial/" target="_blank">how to create a button</a> on your Android application. This tutorial will modify the code in the mentioned button tutorial. And it just involves modifying the <em>main.xml</em> file.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;RelativeLayout</span> </span>
<span style="color: #009900;">    	<span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">    	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ImageView</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/BackImage&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_centerInParent</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">android:scaleType</span>=<span style="color: #ff0000;">&quot;fitXY&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">android:gravity</span>=<span style="color: #ff0000;">&quot;top&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">android:background</span>=<span style="color: #ff0000;">&quot;@android:drawable/ic_btn_speak_now&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ImageView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:layout_alignParentTop</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span></span>
<span style="color: #009900;">	        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">	        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">	        <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/hello&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/button_text&quot;</span> </span>
<span style="color: #009900;">	    <span style="color: #000066;">android:onClick</span>=<span style="color: #ff0000;">&quot;sendMessage&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ImageButton</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:src</span>=<span style="color: #ff0000;">&quot;@drawable/ic_launcher&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:onClick</span>=<span style="color: #ff0000;">&quot;sendQuestion&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>    
&nbsp;
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/button_text&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:drawableLeft</span>=<span style="color: #ff0000;">&quot;@drawable/ic_launcher&quot;</span></span>
<span style="color: #009900;">	    <span style="color: #000066;">android:onClick</span>=<span style="color: #ff0000;">&quot;sendGoodbye&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/RelativeLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><img src="http://htmlpress.net/wp-content/uploads/2013/01/android-background-image.png" /></p>
<p>As seen from the code above, the modifications are self-explanatory. The RelativeLayout tag is added with its basic attributes and the ImageView tag is also added with its attributes. One thing that should be noted though is the LinearLayout attribute <code>android:layout_alignParentTop="true"</code>. This aligns the LinearLayout view right on top of the ImageView. The Parent of the LinearLayout would be the RelativeLayout.</p>
<h3 class='related_post_title'>Related Posts:</h3><ul class='related_post'><li><a href='http://htmlpress.net/how-to-test-your-android-app-on-a-mobile-phone-from-ubuntu/' title='How To Test Your Android App On A Mobile Phone From Ubuntu'>How To Test Your Android App On A Mobile Phone From Ubuntu</a></li><li><a href='http://htmlpress.net/programming-in-an-android-environment/' title='Programming In An Android Environment'>Programming In An Android Environment</a></li><li><a href='http://htmlpress.net/how-to-change-the-api-level-of-an-android-project/' title='How To Change The API Level Of An Android Project'>How To Change The API Level Of An Android Project</a></li><li><a href='http://htmlpress.net/how-to-have-a-vibrate-effect-in-your-application/' title='How To Have A Vibrate Effect In Your Application'>How To Have A Vibrate Effect In Your Application</a></li><li><a href='http://htmlpress.net/how-to-detect-data-connection-in-android/' title='How To Detect Data Connection In Android'>How To Detect Data Connection In Android</a></li></ul>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/how-to-create-a-relative-layout-with-a-background-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming In An Android Environment</title>
		<link>http://htmlpress.net/programming-in-an-android-environment/</link>
		<comments>http://htmlpress.net/programming-in-an-android-environment/#comments</comments>
		<pubDate>Wed, 26 Dec 2012 23:29:01 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[android tutorial]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17304</guid>
		<description><![CDATA[If you have an Android tablet of any Android device that&#8217;s bigger than a mobile phone and is suitable for programming it is good to know what options you can have when developing the next killer app. Fortunately there are quite a lot of ways where you can develop in an Android operating system environment. [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p>If you have an Android tablet of any Android device that&#8217;s bigger than a mobile phone and is suitable for programming it is good to know what options you can have when developing the next killer app. Fortunately there are quite a lot of ways where you can develop in an Android operating system environment. At this stage you actually have three options.</p>
<p><strong>1 &#8211; Third-party websites</strong></p>
<p>There&#8217;s a new breed of websites where you can actually create an account and start programming. In fact we had a <a href="http://htmlpress.net/online-android-development-environment/" target="_blank">post</a> about one of these websites some time ago. Just take a look at our weather app example at <a href="http://www.programr.com/Android/OzWeather" title="android weather app" target="_blank">programr.com</a>. This enables you to program anywhere even if you forget your tablet or android device. Just go to your local internet cafe or local library that has free internet workstations. The obvious disadvantage of these websites is that if you need to include external files on your application (i.e. fonts), use of the mic and sounds, use of location, vibrating effects and other related features that you cannot do in a virtual environment.</p>
<p><strong>2 &#8211; Ubuntu For Android</strong></p>
<p>You read that right. You can actually install Ubuntu where it shares the same kernel of the Android device. Ubuntu For Android was first mentioned in a <a href="http://techcrunch.com/2012/02/21/canonical-announces-ubuntu-for-android/" target="_blank">TechCrunch article</a> at the beginning of this year. This means you can have your Android and Ubuntu operating system all in one smart phone device. When your device is docked and connected to a keyboard and monitor, you get the full Ubuntu desktop experience. And you do not the disadvantages of an online Android virtual environment.</p>
<p><strong>3 &#8211; Android IDE applications</strong></p>
<p>The third option would probably be an obvious one. And that&#8217;s using an Android IDE apps. There&#8217;s quite a handful available in Google Play. <a href="https://play.google.com/store/apps/details?id=com.aide.ui&#038;feature=search_result" target="_blank">AIDE</a> and <a href="https://play.google.com/store/apps/details?id=com.spartacusrex.spartacuside&#038;feature=search_result" target="_blank">Terminal IDE</a> are the two most popular one. This means that you can program anywhere like when you are taking the subway or cab. And best of all there are free and paid versions.</p>
<p>And there you have it. So get your apps ready because 2013 will be the year of Android. </p>
<h3 class='related_post_title'>Related Posts:</h3><ul class='related_post'><li><a href='http://htmlpress.net/how-to-test-your-android-app-on-a-mobile-phone-from-ubuntu/' title='How To Test Your Android App On A Mobile Phone From Ubuntu'>How To Test Your Android App On A Mobile Phone From Ubuntu</a></li><li><a href='http://htmlpress.net/how-to-create-a-relative-layout-with-a-background-image/' title='How To Create A Relative Layout With A Background Image'>How To Create A Relative Layout With A Background Image</a></li><li><a href='http://htmlpress.net/how-to-change-the-api-level-of-an-android-project/' title='How To Change The API Level Of An Android Project'>How To Change The API Level Of An Android Project</a></li><li><a href='http://htmlpress.net/how-to-have-a-vibrate-effect-in-your-application/' title='How To Have A Vibrate Effect In Your Application'>How To Have A Vibrate Effect In Your Application</a></li><li><a href='http://htmlpress.net/how-to-detect-data-connection-in-android/' title='How To Detect Data Connection In Android'>How To Detect Data Connection In Android</a></li></ul>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/programming-in-an-android-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This Website Is Going Mobile First</title>
		<link>http://htmlpress.net/this-website-is-going-mobile-first/</link>
		<comments>http://htmlpress.net/this-website-is-going-mobile-first/#comments</comments>
		<pubDate>Mon, 10 Dec 2012 07:01:45 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17281</guid>
		<description><![CDATA[Readers following this website would recall that it first started as a WordPress tutorial website sprinkled with some articles about web hosting, domaining, internet marketing and basically any article that will help the reader in creating a successful website. This was about two years ago when WordPress has attained the title of being the most [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p>Readers following this website would recall that it first started as a WordPress tutorial  website sprinkled with some articles about web hosting, domaining, internet marketing and basically any article that will help the reader in creating a successful website. This was about two years ago when WordPress has attained the title of being the most popular CMS (Content Management System.</p>
<p>Things have changed on the internet. Websites are still essential, however, the growth is found on mobile phones and tablets. So if you noticed this year, our push to Android tutorial articles came gradually with the interest of merging the two tutorials eventually. With Android, you can develop native applications or develop web applications. For the latter, we will be presenting wordpress tutorials on how to quickly make such applications.</p>
<p>So in the succeeding weeks, you will find more articles about mobile applications and how to create one. At the same time you will gradually see a re-branding of the website into a web applications tutorial site first and native mobile application second. </p>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/this-website-is-going-mobile-first/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Change The API Level Of An Android Project</title>
		<link>http://htmlpress.net/how-to-change-the-api-level-of-an-android-project/</link>
		<comments>http://htmlpress.net/how-to-change-the-api-level-of-an-android-project/#comments</comments>
		<pubDate>Thu, 29 Nov 2012 02:36:36 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[android tutorial]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17275</guid>
		<description><![CDATA[During testing, you might encounter this scenario where you need to test on a different Android Virtual Device with a different API level. For example, in testing the vibrating effect on our weather app, we needed to test this on an actual Android smartphone via USB. The AVD has API level 10 while the Huawei [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p>During testing, you might encounter this scenario where you need to test on a different Android Virtual Device with a different API level. For example, in testing the vibrating effect on our weather app, we needed to test this on an actual Android smartphone via USB. The AVD has API level 10 while the Huawei Android smartphone  has API level 8. Upon running the project, the Android Chooser window appeared to which the smartphone device was selected as shown in the image below.</p>
<p><img src="http://htmlpress.net/wp-content/uploads/2012/11/Android-Device-Chooser-.png" /></p>
<p>Then the following error message occurred in the console tab of Eclipse:</p>
<p><em>[2012-11-29 12:23:26 - Oz Weather] ERROR: Application requires API version 10. Device API version is 8 (Android 2.2.2).<br />
[2012-11-29 12:23:26 - Oz Weather] Launch canceled!</em></p>
<p>To get around this is very simple as shown in the following steps below:</p>
<p>1. In Eclipse, go to <em>Project</em> | <em>Properties</em>.<br />
2. In the <em>Properties</em> window de-select the current API level and choose API level 8.</p>
<p><img src="http://htmlpress.net/wp-content/uploads/2012/11/Properties-for-Oz-Weather.png" /></p>
<p>3. Click the Ok button.<br />
4. In the AndroidManifest.xml file look for the code and change <strong>10</strong> to <strong>8</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-sdk</span> <span style="color: #000066;">android:minSdkVersion</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>5. Save and run the project.</p>
<h3 class='related_post_title'>Related Posts:</h3><ul class='related_post'><li><a href='http://htmlpress.net/how-to-test-your-android-app-on-a-mobile-phone-from-ubuntu/' title='How To Test Your Android App On A Mobile Phone From Ubuntu'>How To Test Your Android App On A Mobile Phone From Ubuntu</a></li><li><a href='http://htmlpress.net/how-to-create-a-relative-layout-with-a-background-image/' title='How To Create A Relative Layout With A Background Image'>How To Create A Relative Layout With A Background Image</a></li><li><a href='http://htmlpress.net/programming-in-an-android-environment/' title='Programming In An Android Environment'>Programming In An Android Environment</a></li><li><a href='http://htmlpress.net/how-to-have-a-vibrate-effect-in-your-application/' title='How To Have A Vibrate Effect In Your Application'>How To Have A Vibrate Effect In Your Application</a></li><li><a href='http://htmlpress.net/how-to-detect-data-connection-in-android/' title='How To Detect Data Connection In Android'>How To Detect Data Connection In Android</a></li></ul>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/how-to-change-the-api-level-of-an-android-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Have A Vibrate Effect In Your Application</title>
		<link>http://htmlpress.net/how-to-have-a-vibrate-effect-in-your-application/</link>
		<comments>http://htmlpress.net/how-to-have-a-vibrate-effect-in-your-application/#comments</comments>
		<pubDate>Thu, 29 Nov 2012 02:13:45 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[android tutorial]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17273</guid>
		<description><![CDATA[One of the niceties about today&#8217;s smartphones is that it has a vibrating effect. This is particularly useful for the user during meetings, movies, etc. And with Android, it is so much easier to implement this as well. For this Android tutorial, we will add a vibrating effect once the weather app is launched. To [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p>One of the niceties about today&#8217;s smartphones is that it has a vibrating effect. This is particularly useful for the user during meetings, movies, etc. And with Android, it is so much easier to implement this as well. For this Android tutorial, we will add a vibrating effect once the <a href="http://htmlpress.net/how-to-create-a-weather-web-app/" title="android weather app">weather app</a> is launched.</p>
<p>To start, follow the steps below:</p>
<p>1. Add the code in <em>AndroidManifest.xml</em> file</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.VIBRATE&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>2. Add the code in <em>OzWeatherActivity.java</em> file. Just place this inside the <em>onCreate</em> method.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">Vibrator v <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>Vibrator<span style="color: #009900;">&#41;</span> getSystemService<span style="color: #009900;">&#40;</span><span style="color: #003399;">Context</span>.<span style="color: #006633;">VIBRATOR_SERVICE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">// Vibrates for 1000 milliseconds  </span>
<span style="color: #000066; font-weight: bold;">long</span> milliseconds <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>  
v.<span style="color: #006633;">vibrate</span><span style="color: #009900;">&#40;</span>milliseconds<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Because there&#8217;s no vibration in an AVD, it is be to plugin your Android phone to your development computer via USB and test it from there.</p>
<h3 class='related_post_title'>Related Posts:</h3><ul class='related_post'><li><a href='http://htmlpress.net/how-to-test-your-android-app-on-a-mobile-phone-from-ubuntu/' title='How To Test Your Android App On A Mobile Phone From Ubuntu'>How To Test Your Android App On A Mobile Phone From Ubuntu</a></li><li><a href='http://htmlpress.net/how-to-create-a-relative-layout-with-a-background-image/' title='How To Create A Relative Layout With A Background Image'>How To Create A Relative Layout With A Background Image</a></li><li><a href='http://htmlpress.net/programming-in-an-android-environment/' title='Programming In An Android Environment'>Programming In An Android Environment</a></li><li><a href='http://htmlpress.net/how-to-change-the-api-level-of-an-android-project/' title='How To Change The API Level Of An Android Project'>How To Change The API Level Of An Android Project</a></li><li><a href='http://htmlpress.net/how-to-detect-data-connection-in-android/' title='How To Detect Data Connection In Android'>How To Detect Data Connection In Android</a></li></ul>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/how-to-have-a-vibrate-effect-in-your-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Detect Data Connection In Android</title>
		<link>http://htmlpress.net/how-to-detect-data-connection-in-android/</link>
		<comments>http://htmlpress.net/how-to-detect-data-connection-in-android/#comments</comments>
		<pubDate>Wed, 28 Nov 2012 01:23:45 +0000</pubDate>
		<dc:creator>htmlpress</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[android tutorial]]></category>

		<guid isPermaLink="false">http://htmlpress.net/?p=17268</guid>
		<description><![CDATA[In one of our past tutorials you have learned to detect if you have internet connection by way of checking if your Android smartphone is in airplane mode. But what if it isn&#8217;t in airplane mode? Android provides a way to turn on/off your data connection (which enables/disables you to send sms and surf the [...]]]></description>
				<content:encoded><![CDATA[<div class="KonaBody"><p>In one of our past tutorials you have learned to detect if you have internet connection by way of checking if your Android smartphone is in <a href="http://htmlpress.net/how-to-detect-if-your-mobile-app-has-internet-connection/">airplane mode</a>. But what if it isn&#8217;t in airplane mode?</p>
<p>Android provides a way to turn on/off your data connection (which enables/disables you to send sms and surf the internet) through its <em>Settings | Wireless &#038; Networks | Mobile Network</em> menu. And from there you can toggle on/off the <em>Data enabled</em> switch.</p>
<p>Programmatically, you can detect the data state of your smartphone. Just implement the code below on you main java file.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isDataConnectionAvailable<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">boolean</span> lRet <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span><span style="color: #009900;">&#123;</span>
            ConnectivityManager conMgr <span style="color: #339933;">=</span>  ConnectivityManager<span style="color: #009900;">&#41;</span>getSystemService<span style="color: #009900;">&#40;</span><span style="color: #003399;">Context</span>.<span style="color: #006633;">CONNECTIVITY_SERVICE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            NetworkInfo info<span style="color: #339933;">=</span> conMgr.<span style="color: #006633;">getActiveNetworkInfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>info <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> info.<span style="color: #006633;">isConnected</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  
                lRet <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span> <span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>  
                lRet <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span> <span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            Log.<span style="color: #006633;">d</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;isDataConnectionAvailable&quot;</span>, <span style="color: #0000ff;">&quot;Normal execution...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            Log.<span style="color: #006633;">d</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Connection Error&quot;</span>, e.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            lRet <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span> <span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">return</span> lRet<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And on your <em>AndroidManifest.xml</em> file add the following:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.ACCESS_NETWORK_STATE&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>To test this method, just add the following codes in you main Activity file:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isDataConnectionAvailable<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;Data connection is enabled.&quot;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
   Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;Data connection is disabled.&quot;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>By informing users of your app about their data state it will even make your Android app more user-friendly.</p>
<h3 class='related_post_title'>Related Posts:</h3><ul class='related_post'><li><a href='http://htmlpress.net/how-to-test-your-android-app-on-a-mobile-phone-from-ubuntu/' title='How To Test Your Android App On A Mobile Phone From Ubuntu'>How To Test Your Android App On A Mobile Phone From Ubuntu</a></li><li><a href='http://htmlpress.net/how-to-create-a-relative-layout-with-a-background-image/' title='How To Create A Relative Layout With A Background Image'>How To Create A Relative Layout With A Background Image</a></li><li><a href='http://htmlpress.net/programming-in-an-android-environment/' title='Programming In An Android Environment'>Programming In An Android Environment</a></li><li><a href='http://htmlpress.net/how-to-change-the-api-level-of-an-android-project/' title='How To Change The API Level Of An Android Project'>How To Change The API Level Of An Android Project</a></li><li><a href='http://htmlpress.net/how-to-have-a-vibrate-effect-in-your-application/' title='How To Have A Vibrate Effect In Your Application'>How To Have A Vibrate Effect In Your Application</a></li></ul>
</div>]]></content:encoded>
			<wfw:commentRss>http://htmlpress.net/how-to-detect-data-connection-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
