<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Android Competency Center</title>
	
	<link>http://www.androidcompetencycenter.com</link>
	<description>Tutorials, Tips and tricks, Tools for Android development</description>
	<lastBuildDate>Sat, 05 Feb 2011 09:10:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AndroidCompetencyCenter" /><feedburner:info uri="androidcompetencycenter" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>New adventure</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/rU1lfGU0hCA/</link>
		<comments>http://www.androidcompetencycenter.com/2011/02/new-adventure/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 09:10:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=622</guid>
		<description><![CDATA[We just wanted to give a shout out about our new adventure Prolinkd. You can read more about what it is on blog. Even though we will be launching mobile apps for prolinkd, and hence we will keep learning new things about Android, we would like to invite all our readers to contribute to keep [...]]]></description>
				<content:encoded><![CDATA[<p>We just wanted to give a shout out about our new adventure <a href="http://prolinkd.com">Prolinkd</a>. You can read more about what it is on <a href="http://prolinkd.posterous.com">blog</a>.</p>
<p>Even though we will be launching mobile apps for prolinkd, and hence we will keep learning new things about Android, we would like to invite all our readers to contribute to keep AndroidCompetencyCenter alive.</p>
<p>If you are an android developer and would like to contribute to the posts/articles/tutorials on this blog, then drop me a line on bidwai.sushrut@gmail.com.</p>
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/rU1lfGU0hCA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2011/02/new-adventure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2011/02/new-adventure/</feedburner:origLink></item>
		<item>
		<title>PhoneGap in Android(Eclipse)</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/JlQUYMV4b-8/</link>
		<comments>http://www.androidcompetencycenter.com/2010/07/phonegap-in-androideclipse/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 11:19:50 +0000</pubDate>
		<dc:creator>zeeshan</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Android API]]></category>
		<category><![CDATA[Android Tools]]></category>
		<category><![CDATA[Phonegap]]></category>
		<category><![CDATA[phonegapinandroid]]></category>
		<category><![CDATA[phonegapineclipse]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=580</guid>
		<description><![CDATA[Prerequisites for System - 1.Java JDK 1.6 2.Eclipse 3.Android sdk package 4.ADT Plug-in for Eclipse with required Android sdk components. 5.Download and unzip Apache ANT and add it to your PATH(if eclipse doesn&#8217;t provide you). 6.Download and install Ruby(http://www.ruby-lang.org/en/downloads/), only for windows/linux user,mac OS already has an installed Ruby. Steps for installing phone-gap- 1.download the [...]]]></description>
				<content:encoded><![CDATA[<p><strong>Prerequisites for System -</strong></p>
<p>1.Java JDK 1.6<br />
2.Eclipse<br />
3.Android sdk package<br />
4.ADT Plug-in for Eclipse with required Android sdk components.<br />
5.Download and unzip Apache ANT and add it to your PATH(if eclipse doesn&#8217;t provide you).<br />
6.Download and install Ruby(<a href="http://www.ruby-lang.org/en/downloads/" target="_blank">http://www.ruby-lang.org/en/downloads/</a>), only for windows/linux user,mac OS already has an installed Ruby.</p>
<p><strong>Steps for installing phone-gap-</strong></p>
<p>1.download the latest framework version of PhoneGap from <a href="http://github.com/phonegap/phonegap-android" target="_blank">http://github.com/phonegap/phonegap-android</a>.</p>
<p>2.After downloading &#8216;phonegap-phonegap-android-{dc58c67}&#8217; zip or tar file,unzip and rename it as &#8216;phonegap-android&#8217;  folder.</p>
<p>3.Run the ruby command in &#8216;phonegap-android&#8217; folder as -</p>
<ul>
<li> To run the command directly in  folder -ruby .\droidgap &#8220;[android_sdk_path]&#8221; [name] [package_name] &#8220;[www]&#8221; &#8220;[path]&#8220;</li>
<li> To run the command in command prompt(terminal) -ruby ./droidgap &#8220;[android_sdk_path]&#8221; [name] [package_name] &#8220;[www]&#8221; &#8220;[path]&#8220;</li>
</ul>
<p>parameter description-</p>
<ul>
<li> android_sdk_path -The path to your Android SDK install.</li>
<li> name                     -The name of your application.</li>
<li> package_name      -The name of your package (For example: com.wissen.sample)</li>
<li> www                     -The path to your www folder. (Where is your HTML, CSS and 			 JS files is all ready present just like copy from iphone app.)</li>
<li> path 		          -The path to generate the application. (can not be inside any Eclipse workspace)</li>
</ul>
<p>You should get a message in your terminal saying completed,which create complete Android application having src,assets,res and AndroidManifest.xml,including lib contain phonegap.jar file which can be use further in your application.</p>
<p>4.Opening the phonegap project in eclipse -<br />
Open the &#8216;New Android Project&#8217; window in eclipse and select checkbox &#8216;Create 	Project form existing source&#8217;,given the path of project which is just created by 	using 	ruby command and fill up the all necessary information as we fill up for 	normal android project,press finish to open the application in eclipse.</p>
<p>5.Right click on phonegap.jar under the libs folder and go to Buildpath-&gt; Add to build path.</p>
<p>6.Select proper minimum sdk version in AndroidManifest.xml file.</p>
<p>7.Click on run button in eclipse or using right click on project in package explorer,select Run As Android Application, after successful run,you will see the html content on your android emulator.</p>
<p><strong>Now Easy steps to do further phonegap applications-</strong></p>
<p>1.Create new simple android project in eclipse as shown in following picture-</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-450" src="http://www.androidcompetencycenter.com/wp-content/uploads/2010/07/1.png" alt="before" width="350" height="500" /></p>
<p>2.Under the android &#8216;<strong>assets</strong>&#8216; folder create new folder &#8216;<strong>www</strong>&#8216; from new menu or right click and new option,like shown in following picture,</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-450" src="http://www.androidcompetencycenter.com/wp-content/uploads/2010/07/2.png" alt="before" /></p>
<p>3.Create new file <strong>&#8216;index.html&#8217;</strong> in www folder(you can create html,css and js files here),you can copy <strong>phonegap.js</strong> file from phonegap framework to access natives in your application, following picture show you the whole idea,</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-450" src="http://www.androidcompetencycenter.com/wp-content/uploads/2010/07/3.png" alt="before" /></p>
<p>4.Write html code in index file for example like this-</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-450" src="http://www.androidcompetencycenter.com/wp-content/uploads/2010/07/4.png" alt="before" /></p>
<p>5.Now Create new folder &#8216;<strong>libs</strong>&#8216; in a project and copy the &#8216;<strong>phonegap.jar</strong>&#8216; file from  downloaded phonegap framework or copy from the project which is created using command &#8216;ruby ./droidgap&#8217; and paste the &#8216;phonegap.jar&#8217; file under the &#8216;libs&#8217; folder,like this</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-450" src="http://www.androidcompetencycenter.com/wp-content/uploads/2010/07/5.png" alt="before" /></p>
<p>6.Right click on phonegap.jar under the libs folder and go to <strong>Buildpath</strong>-&gt; Add to the build path.</p>
<p>7.Open the main activity java class and main class will<span style="color: #7f0055"><span style="font-size: x-small"><span style="font-family: Monaco,monospace"><strong> </strong></span></span></span><span style="font-size: medium"><span style="color: #7f0055"><span style="font-family: Monaco,monospace"><span style="font-size: x-small"><strong>extends</strong></span></span></span><span style="color: #000000"><span style="font-family: Monaco,monospace"><span style="font-size: x-small"> DroidGap</span></span></span></span><span style="color: #000000"><span style="font-size: x-small"><span style="font-family: Monaco,monospace"> </span></span></span>instead of <span style="font-size: medium"><span style="color: #7f0055"><span style="font-family: Monaco,monospace"><span style="font-size: x-small"><strong>extends</strong></span></span></span></span> <span style="color: #000000"><span style="font-size: x-small"><span style="font-family: Monaco,monospace">Activity</span></span></span> ,import package com.phonegap.DroidGap from phonegap.jar,                                       like this-<span style="font-size: medium"><span style="color: #7f0055"><span style="font-family: Monaco,monospace"><span style="font-size: x-small"><strong>import</strong></span></span></span></span> <span style="color: #000000"><span style="font-size: x-small"><span style="font-family: Monaco,monospace">com.phonegap.DroidGap</span></span></span>;</p>
<p>8.Also instead of <span style="font-size: medium"><span style="color: #000000"><span style="font-family: Monaco,monospace"><span style="font-size: x-small">setContentView(R.layout.</span></span></span><span style="color: #0000c0"><span style="font-family: Monaco,monospace"><span style="font-size: x-small"><em>main</em></span></span></span><span style="color: #000000"><span style="font-family: Monaco,monospace"><span style="font-size: x-small">);</span></span></span></span>,used <span style="font-size: medium"><span style="color: #7f0055"><span style="font-family: Monaco,monospace"><span style="font-size: x-small"><strong>super</strong></span></span></span><span style="color: #000000"><span style="font-family: Monaco,monospace"><span style="font-size: x-small">.loadUrl(</span></span></span><span style="color: #2a00ff"><span style="font-family: Monaco,monospace"><span style="font-size: x-small">&#8220;file:///android_asset/www/index.html&#8221;</span></span></span><span style="color: #000000"><span style="font-family: Monaco,monospace"><span style="font-size: x-small">);</span></span></span></span> , now your activity  file must look like this-</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-450" src="http://www.androidcompetencycenter.com/wp-content/uploads/2010/07/6.png" alt="before" /></p>
<p>9.<strong>Run</strong> the application from the play like image of tool bar or right click on project select Run as Android Application.</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-450" src="http://www.androidcompetencycenter.com/wp-content/uploads/2010/07/7.png" alt="before" /></p>
<p>10.After successful run, project output will look like this-</p>
<p style="text-align: center"><img class="aligncenter size-full wp-image-450" src="http://www.androidcompetencycenter.com/wp-content/uploads/2010/07/8.png" alt="before" width="200" height="300" /></p>
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/JlQUYMV4b-8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2010/07/phonegap-in-androideclipse/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2010/07/phonegap-in-androideclipse/</feedburner:origLink></item>
		<item>
		<title>JSON Parsing in android</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/U13Rb9b6wPo/</link>
		<comments>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 12:21:13 +0000</pubDate>
		<dc:creator>zeeshan</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Android API]]></category>
		<category><![CDATA[Mobile Market]]></category>
		<category><![CDATA[-1]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[to]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462</guid>
		<description><![CDATA[Let&#8217;s look at how to parse JSON objects in android 1&#62; First we&#8217;ll need an example : Lets look at a standard example from the json site http://json.org/example.html {"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }} you could [...]]]></description>
				<content:encoded><![CDATA[<p><!-- 	 	 --></p>
<p>Let&#8217;s look at  how to parse  JSON  objects in android</p>
<p>1&gt;   First we&#8217;ll need an example :</p>
<p>Lets look at a standard example from the json site <a href="http://json.org/example.html">http://json.org/example.html</a></p>
<pre name="code"  class="java"> 
     {"menu": {
				  "id": "file",
				  "value": "File",
				  "popup": {
				    "menuitem": [
				      {"value": "New", "onclick": "CreateNewDoc()"},
				      {"value": "Open", "onclick": "OpenDoc()"},
				      {"value": "Close", "onclick": "CloseDoc()"}
				    ]
				  }
				}}
</pre>
<p>you could either save this in a file or save it in a string&#8230;..like I&#8217;ve done</p>
<p>2&gt; Android already contains the required JSON libraries</p>
<p>Lets create a JSON Object;</p>
<pre name="code" class="java" >
private JSONObject jObject; 
</pre>
<p>and lets our example be a String ,</p>
<pre name="code"  class="java">
private String jString = "{\"menu\":	{\"id\": \"file\", \"value\": \"File\", \"popup\": { \"menuitem\": 	[ {\"value\": \"New\", \"onclick\": \"CreateNewDoc()\"}, 	{\"value\": \"Open\", \"onclick\": \"OpenDoc()\"}, 	 	{\"value\": \"Close\", \"onclick\": \"CloseDoc()\"}]}}}";
</pre>
<p>now we have to convert jString to the jObject ,</p>
<pre  name="code" class="java" >jObject = new JSONObject(jString); </pre>
<p>Now we have to start extracting the content from  jObject ,</p>
<p>Lets extract the menu object  by creating a new menu object,</p>
<pre  name="code" class="java" >
JSONObject menuObject = jObject.getJSONObject("menu");
</pre>
<p>Now lets extract its atrtibutes ,</p>
<pre name="code"  class="java"> 
String attributeId = menuObject.getString("id");
String attributeValue = menuObject.getString("value");
JSONObject popupObject = menuObject.getJSONObject("popup");
</pre>
<p>since &#8220;popup&#8221; is not plainly a String lets extract it to an object ,</p>
<p>3&gt; Now popup contains an array of &#8220;menuitem&#8221;</p>
<p>So, we&#8217;ll have to extract it to a JSONArray,</p>
<pre  name="code" class="java" > JSONArray menuitemArray = popupObject.getJSONArray("menuitem"); </pre>
<p>Since it contains 3  items lets put it in a for loop.</p>
<pre name="code" class="java" >
for (int i = 0; i < 3; i++) {
			System.out.println(menuitemArray.getJSONObject(i)
					.getString("value").toString());
			System.out.println(menuitemArray.getJSONObject(i).getString(
					"onclick").toString());
		}

</pre>
<p align="left">
<p align="left">Basically thats it , u should see the output in the DDMS</p>
<p align="left">
<p align="left">4&gt; The full code is as below,</p>
<p align="left">
<pre name="code" class="java">
import org.json.JSONArray;
import org.json.JSONObject;
import android.app.Activity;
import android.os.Bundle;

public class JsonParser extends Activity {
	private JSONObject jObject;
	private String jString = "{\"menu\": {\"id\": \"file\", \"value\": \"File\", \"popup\": { \"menuitem\": [ {\"value\": \"New\",   \"onclick\": \"CreateNewDoc()\"}, {\"value\": \"Open\", \"onclick\": \"OpenDoc()\"}, {\"value\": \"Close\", \"onclick\": \"CloseDoc()\"}]}}}";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		try {
			parse();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void parse() throws Exception {
		jObject = new JSONObject(jString);

		JSONObject menuObject = jObject.getJSONObject("menu");
		String attributeId = menuObject.getString("id");
		System.out.println(attributeId);

		String attributeValue = menuObject.getString("value");
		System.out.println(attributeValue);

		JSONObject popupObject = menuObject.getJSONObject("popup");
		JSONArray menuitemArray = popupObject.getJSONArray("menuitem");

		for (int i = 0; i < 3; i++) {
			System.out.println(menuitemArray.getJSONObject(i)
					.getString("value").toString());
			System.out.println(menuitemArray.getJSONObject(i).getString(
					"onclick").toString());
		}
	}
}
</pre>
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/U13Rb9b6wPo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/feed/</wfw:commentRss>
		<slash:comments>80</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/</feedburner:origLink></item>
		<item>
		<title>Styles and Themes</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/mmDyiWZYz7s/</link>
		<comments>http://www.androidcompetencycenter.com/2009/10/styles-and-themes/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 13:55:28 +0000</pubDate>
		<dc:creator>zeeshan</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Mobile Market]]></category>
		<category><![CDATA[blur]]></category>
		<category><![CDATA[blurred]]></category>
		<category><![CDATA[dialog]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[no title]]></category>
		<category><![CDATA[notitle]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[styles]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[transparent]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=448</guid>
		<description><![CDATA[Hello coders, Lets look at a fairly simple example of creating a transparent theme and how to apply it to a Dialog&#8230;&#8230; Step 1&#62; Create a colors.xml file in the &#8216;values&#8217; folder under &#8216;res&#8217; and add the following line.. &#60;drawable name="transparent"&#62;#00000000&#60;/drawable&#62; Step 2&#62; Create a styles.xml file in the &#8216;values&#8217; folder under &#8216;res&#8217; and the [...]]]></description>
				<content:encoded><![CDATA[<p><!-- 	 	 --></p>
<p>Hello coders,</p>
<p>Lets look at a fairly simple example of  creating a transparent theme and how to apply it to a Dialog&#8230;&#8230;</p>
<p>Step 1&gt;  Create a colors.xml file in the &#8216;values&#8217; folder under &#8216;res&#8217;  and add the following line..</p>
<pre name="code" class="xml">&lt;drawable name="transparent"&gt;#00000000&lt;/drawable&gt;</pre>
<p>Step 2&gt;  Create a styles.xml file in the &#8216;values&#8217; folder under &#8216;res&#8217; and the following lines&#8230;</p>
<pre name= "code" class="xml">&lt;style name=<em>"Transparent"</em>&gt;
&lt;item name=<em>"android:windowIsTranslucent"</em>&gt;true&lt;/item&gt;
&lt;item name=<em>"android:windowAnimationStyle"</em>&gt;
@android:style/Animation.Translucent
&lt;/item&gt;
&lt;item name=<em>"android:windowBackground"</em>&gt;<span style="text-decoration: underline;">@drawable</span>/transparent&lt;/item&gt;
&lt;item name=<em>"android:windowNoTitle"</em>&gt;true&lt;/item&gt;
&lt;item name=<em>"android:colorForeground"</em>&gt;#<span style="text-decoration: underline;">fff</span>&lt;/item&gt;
&lt;/style&gt;</pre>
<p>( I guess the tags and attributes are self explanatory &#8230;. )</p>
<p>Step 3&gt; Actually thats it&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>Let&#8217;s  add this to a dialog&#8230;..</p>
<p>Step 4&gt;  Create a  class  with the following lines&#8230;&#8230;</p>
<pre name="code" class="java">public class DialogBox extends Dialog {

    public DialogBox(Context context, int theme) {
        super(context, theme);
        setContentView(R.layout.dialog);
        okButton = (Button) findViewById(R.id.dialog_OkButton);
        setListeners();
    }
}</pre>
<p>(Make sure you create a layout for the dialog )</p>
<p>Step 5&gt;  Next create an activity class as follows&#8230;.</p>
<pre name="code" class="java">public class T_Temp extends Activity {

    private DialogBox dialog;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        dialog = new DialogBox(this, R.style.Transparent);
        dialog.show();
    }
}</pre>
<p>When creating the dialog just add the transparent theme &#8230;&#8230;</p>
<p>Step 6&gt;      That&#8217;s it &#8230;</p>
<p>( don&#8217;t forget to add the activity in the android manifest file..)</p>
<p>When you add the widgets and background it will look something like this..</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-450" src="http://www.androidcompetencycenter.com/wp-content/uploads/2009/10/before.jpg" alt="before" width="170" height="200" /></p>
<p style="text-align: center;">Before</p>
<p style="text-align: center;"><img class="aligncenter size-medium wp-image-451" src="http://www.androidcompetencycenter.com/wp-content/uploads/2009/10/after-274x300.jpg" alt="after" width="170" height="200" /></p>
<p style="text-align: center;">After</p>
<p>Step 7&gt;   Another trick is you can make the background blurred &#8230;.</p>
<p>just add the following line in the dialog box&#8230;</p>
<pre name="code" class="java">
   getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
</pre>
<p align="left">Output looks somthing like this&#8230;&#8230;.</p>
<p style="text-align: center;" align="left"><img class="aligncenter size-medium wp-image-460" src="http://www.androidcompetencycenter.com/wp-content/uploads/2009/10/blurred-274x300.jpg" alt="blurred" width="170" height="200" /></p>
<p align="left">
<p align="left">
<p>So the final code is:</p>
<pre name="code" class="java" >
public class DialogBox extends Dialog {

    public DialogBox(Context context, int theme) {
        super(context, theme);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
        setContentView(R.layout.dialog);
        okButton = (Button) findViewById(R.id.dialog_OkButton);
        setListeners();
    }
}</pre>
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/mmDyiWZYz7s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2009/10/styles-and-themes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2009/10/styles-and-themes/</feedburner:origLink></item>
		<item>
		<title>Play Video</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/uamlwSDL33U/</link>
		<comments>http://www.androidcompetencycenter.com/2009/08/play-video/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 10:34:51 +0000</pubDate>
		<dc:creator>zeeshan</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[3gp]]></category>
		<category><![CDATA[novice]]></category>
		<category><![CDATA[push]]></category>
		<category><![CDATA[push file]]></category>
		<category><![CDATA[push video]]></category>
		<category><![CDATA[sdcard]]></category>
		<category><![CDATA[setvideopath]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[video view]]></category>
		<category><![CDATA[videoview]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=435</guid>
		<description><![CDATA[Hello, Here we are going to play a 3gp video in our Android application. The important point we have to note is that video doesn&#8217;t plays when placed in the raw folder.Hence it has to be placed in the SDCARD itself. So lets begin this interesting topic. Ok, let us first insert our video: You [...]]]></description>
				<content:encoded><![CDATA[<p><!-- 		@page { size: 21cm 29.7cm; margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
<p style="margin-bottom: 0cm;">Hello,</p>
<p style="margin-bottom: 0cm;">Here we are going to play a 3gp video in our Android application.</p>
<p style="margin-bottom: 0cm;">The important point we have to note is that video doesn&#8217;t plays when placed in    the raw folder.Hence it has to be placed in the SDCARD itself.</p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">So lets begin this interesting topic.</p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">Ok, let us first insert our video:</p>
<ul>
<li>
<p style="margin-bottom: 0cm;">You 	can get a short 3gp video from net (I got it from 	<a href="http://www.free-3gp-video.com/">http://www.free-3gp-video.com</a>).</p>
</li>
<li>
<p style="margin-bottom: 0cm;">In 	eclipse open perspective DDMS(Window 	&#8211;&gt; Open Perspective &#8211;&gt; DDMS) .</p>
</li>
<li>
<p style="margin-bottom: 0cm;">In 	DDMS perspective open view File 	Explorer(Window &#8211;&gt; Show View &#8211;&gt; 	File Explorer).</p>
</li>
<li>
<p style="margin-bottom: 0cm;">Also 	open Device view (Window 	&#8211;&gt; Show View &#8211;&gt; Device) and click the emulator you 	want to use(if emulator is not running then run a emulator with a 	sdcard option).</p>
</li>
<li>
<p style="margin-bottom: 0cm;">Then 	in File Explorer view navigate the tree 	shown and click sdcard node.</p>
</li>
<li>
<p style="margin-bottom: 0cm;">There 	are two buttons on the top right hand side of File 	Explorer as shown below</p>
</li>
</ul>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;">
<div id="attachment_439" class="wp-caption aligncenter" style="width: 658px"><img class="size-full wp-image-439" src="http://www.androidcompetencycenter.com/wp-content/uploads/2009/08/pushvid1.jpg" alt="push a video onto the sdcard" width="648" height="61" /><p class="wp-caption-text">push a video onto the sdcard</p></div>
<ul>
<li>
<p style="margin-bottom: 0cm;">Click 	the button “Push a file onto the device” 	and in the file chooser navigate and choose the 3gp video.It should 	appear in the list of sdcard.(If not able to insert, check whether 	SDCARD is emulated in the emulator , in 1.5 sdk while creating a new 	Emulator there is a option of sdcard , insert 	128M in the textbox next to it).</p>
</li>
</ul>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;">
<ul>
<li>
<p style="margin-bottom: 0cm;">Ok, 	back to our code, open java perspective(Window 	&#8211;&gt;Show View &#8211;&gt; Java) and open layout file Main.xml.</p>
</li>
<li>
<p style="margin-bottom: 0cm;">Replace 	the its content with following contents:</p>
</li>
</ul>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br />
&lt;FrameLayout<br />
xmlns:android=&#8221;http://schemas.android.com/apk/res/android&#8221;<br />
android:layout_width=&#8221;fill_parent&#8221;<br />
android:layout_height=&#8221;fill_parent&#8221;&gt;<br />
&lt;VideoView<br />
android:id=&#8221;@+id/myvideo&#8221;<br />
android:layout_gravity=&#8221;center&#8221;&gt;<br />
&lt;/VideoView&gt;<br />
&lt;/FrameLayout&gt;</p>
<ul>
<li>
<p style="margin-bottom: 0cm;">Now 	open your main activity and insert the following in the onCreate 	method as:</p>
</li>
</ul>
<pre class="java">super.onCreate(savedInstanceState);

// set the view to our layout file

setContentView(R.layout.main);
// Video view: to view our video
VideoView video = (VideoView) findViewById(R.id.myvideo);

//set video path to our video(in this case man-cheetah-gazalle.3gp)
video.setVideoPath("/sdcard/man-cheetah-gazelle.3gp");
video.start();</pre>
<p style="margin-left: 1.22cm; margin-bottom: 0cm;" align="left">
<ul>
<li>
<p style="margin-bottom: 0cm;" align="left">Run 	the application and the video runs as shown below:</p>
</li>
</ul>
<div id="attachment_440" class="wp-caption aligncenter" style="width: 330px"><img class="size-full wp-image-440" src="http://www.androidcompetencycenter.com/wp-content/uploads/2009/08/output.jpg" alt="Video snapshot" width="320" height="480" /><p class="wp-caption-text">Video snapshot</p></div>
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/uamlwSDL33U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2009/08/play-video/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2009/08/play-video/</feedburner:origLink></item>
		<item>
		<title>View site in a new Window(Browser)</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/tyoVrUIYuMQ/</link>
		<comments>http://www.androidcompetencycenter.com/2009/08/view-site-in-a-new-windowbrowser/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 11:43:48 +0000</pubDate>
		<dc:creator>zeeshan</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[intent]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[open site]]></category>
		<category><![CDATA[open url]]></category>
		<category><![CDATA[site]]></category>
		<category><![CDATA[uri]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=428</guid>
		<description><![CDATA[Hello , Ever thought to include a feature in your application where user clicks a link of certain site or your personal website in the about section of the application and it opens the site in a window and when user finished viewing your achievement and clicks back button your application again gets displayed. We [...]]]></description>
				<content:encoded><![CDATA[<p style="margin-bottom: 0cm;">Hello ,</p>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;">Ever thought to include a feature in your application where user clicks a link of certain site or your personal website in the about section of the application and it opens the site in a window and when user finished viewing your achievement and clicks back button your application again gets displayed.</p>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;">
<p style="margin-left: 1.25cm; margin-bottom: 0cm;">We are going to perform this in just two lines.</p>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;">
<ul>
<li>
<p style="margin-bottom: 0cm;">So first we have to 	create a intent.</p>
</li>
</ul>
<p style="margin-left: 2.5cm; margin-bottom: 0cm;">As we already know intent is an abstract description of an operation to be performed.</p>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;">
<p style="margin-left: 2.5cm; margin-bottom: 0cm;">So we are going to use another version of intent which has following format.</p>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;">
<pre class="java">public Intent(String action,Uri uri)</pre>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;">
<p style="margin-left: 2.5cm; margin-bottom: 0cm;">Here:</p>
<p style="margin-left: 3.75cm; margin-bottom: 0cm;">action is the action we intent(i.e the action we want to perform).</p>
<p style="margin-left: 3.75cm; margin-bottom: 0cm;">uri is the URL on which the above action is to be performed.</p>
<h4>create and intent as</h4>
<pre class="java">Intent viewIntent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.wissen.co.in"));</pre>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-left: 2.5cm; margin-bottom: 0cm;" align="left">The above intents means that we want the system to perform a View Action on uri &#8220;<a href="http://www.wissen.co.in/">http://www.wissen.co.in</a>&#8221; (i.e. To view it).</p>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;" align="left">
<p style="margin-left: 1.25cm; margin-bottom: 0cm;" align="left">
<ul>
<li>
<p style="margin-bottom: 0cm;" align="left">Next 	start this activity as:</p>
</li>
</ul>
<p style="margin-left: 1.25cm; margin-bottom: 0cm;" align="left">
<pre class="java">startActivity(viewIntent);</pre>
<p style="margin-left: 2.5cm; margin-bottom: 0cm;" align="left">
<p style="margin-left: 1.25cm; margin-bottom: 0cm;" align="left">
<ul>
<li>
<p style="margin-bottom: 0cm;" align="left">The 	site will open in browser as</p>
</li>
</ul>
<div class="mceTemp">
<dl id="attachment_429" class="wp-caption alignnone" style="width: 330px;">
<dt><img class="size-full wp-image-429" src="http://www.androidcompetencycenter.com/wp-content/uploads/2009/08/viewsite.jpg" alt="Site opens in a new window(browser)" width="320" height="480" /></dt>
<dd>Site opens in a new window(browser)</dd>
</dl>
</div>
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/tyoVrUIYuMQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2009/08/view-site-in-a-new-windowbrowser/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2009/08/view-site-in-a-new-windowbrowser/</feedburner:origLink></item>
		<item>
		<title>Creating custom Views</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/s6Xl76wp6-M/</link>
		<comments>http://www.androidcompetencycenter.com/2009/08/creatingcustomviews/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 07:55:20 +0000</pubDate>
		<dc:creator>zeeshan</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[graphic]]></category>
		<category><![CDATA[onDraw]]></category>
		<category><![CDATA[paint]]></category>
		<category><![CDATA[surface]]></category>
		<category><![CDATA[view]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=416</guid>
		<description><![CDATA[Hi All , Today we&#8217;ll discuss on how to create a canvas using views. Step 1&#62; We&#8217;ll start off by extending our class by the android.view.View example: public class DrawView extends View { /** * Constructor */ public DrawView(Context context) { super(context); } } Step 2&#62; Next we&#8217;ll use the onDraw() function provided by the [...]]]></description>
				<content:encoded><![CDATA[<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">Hi All ,</p>
<p style="margin-bottom: 0cm;">Today we&#8217;ll discuss on how to create a canvas using views.</p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">Step 1&gt;</p>
<p style="margin-bottom: 0cm;">We&#8217;ll start off by extending our class by the  android.view.View</p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">example:</p>
<pre class="java">public class DrawView extends View {
		/**
		 * Constructor
		 */
		public DrawView(Context context) {
			super(context);
		}
	}</pre>
<p style="margin-bottom: 0cm;">Step 2&gt;</p>
<p style="margin-bottom: 0cm;">Next we&#8217;ll use the onDraw()  function  provided by the View class.</p>
<p style="margin-bottom: 0cm;">( Tip:  In Eclipse Ganymede 3.4.1 ,</p>
<p style="margin-bottom: 0cm;">use Ctrl+space to see the available methods and select onDraw(&#8230;) )</p>
<p style="margin-bottom: 0cm;">It will look something like this&#8230;</p>
<p style="margin-bottom: 0cm;">
<pre class="java">public class DrawView extends View {

		/**
		 * Constructor
		 */
		public DrawView(Context context) {
			super(context);
		}

		protected void onDraw(Canvas canvas) {
			super.onDraw(canvas);
		}
	}</pre>
<p style="margin-bottom: 0cm;">Step 3 &gt;</p>
<p style="margin-bottom: 0cm;">Lets draw some Text in it..</p>
<p style="margin-bottom: 0cm;">For that we&#8217;ll need the paint class.</p>
<p style="margin-bottom: 0cm;">Let&#8217;s create an object of Paint..</p>
<p style="margin-bottom: 0cm;">
<pre class="java">private Paint paint = new Paint();</pre>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">( Android javadoc :</p>
<p style="margin-bottom: 0cm;">The Paint class holds the style and color information about how to</p>
<p style="margin-bottom: 0cm;">draw geometries, text and bitmaps.  )</p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">Let&#8217;s set its properties..</p>
<p style="margin-bottom: 0cm;">
<pre class="java">
// set's the paint's colour
paint.setColor(Color.WHITE);
// set's paint's text size
paint.setTextSize(25);
// smooth's out the edges of what is being drawn
paint.setAntiAlias(true);
</pre>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">Step 4&gt;</p>
<p style="margin-bottom: 0cm;">Let&#8217;s draw the actual text&#8230;</p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<pre class="java" > canvas.drawText("Hello World", 5 , 30 ,paint); </pre>
</p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;">The final code will look some thing like this&#8230;</p>
<p style="margin-bottom: 0cm;">
<pre class="java"> 
public class DrawView extends View {

		private Paint paint;

		/**
		 * Constructor
		 */
		public DrawView(Context context) {
			super(context);

			paint = new Paint();
			// set's the paint's colour
			paint.setColor(Color.GREEN);
			// set's paint's text size
			paint.setTextSize(25);
			// smooth's out the edges of what is being drawn
			paint.setAntiAlias(true);
		}

		protected void onDraw(Canvas canvas) {
			super.onDraw(canvas);

			canvas.drawText("Hello World", 5, 30, paint);
			// if the view is visible onDraw will be called at some point
			// in the future
			invalidate();
		}
	}
</pre>
<p style="margin-bottom: 0cm;" align="left">Step 5&gt;</p>
<p style="margin-bottom: 0cm;" align="left">Now we need to display this View &#8230;.</p>
<p style="margin-bottom: 0cm;" align="left">For that we need to create an activity and set its content view as this DrawView.</p>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">One way is to suclass DrawView or create a new class file of DrawView..</p>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">The final code looks something like this&#8230;</p>
<p style="margin-bottom: 0cm;" align="left">
<pre class="java">
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;

public class temp extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new DrawView(this));
	}

	private class DrawView extends View {

		private Paint paint;
		/**
		 * Constructor
		 */
		public DrawView(Context context) {
			super(context);

			paint = new Paint();
			// set's the paint's colour
			paint.setColor(Color.GREEN);
			// set's paint's text size
			paint.setTextSize(25);
			// smooth's out the edges of what is being drawn
			paint.setAntiAlias(true);
		}

		protected void onDraw(Canvas canvas) {
			super.onDraw(canvas);

			canvas.drawText("Hello World", 5, 30, paint);
			// if the view is visible onDraw will be called at some point in the
			// future
			invalidate();
		}
	}
}

</pre>
<p style="margin-bottom: 0cm;" align="left">The output looks like..</p>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left"><img class="alignnone size-full wp-image-419" src="http://www.androidcompetencycenter.com/wp-content/uploads/2009/08/device.jpg" alt="output" width="320" height="480" /></p>
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<p style="margin-bottom: 0cm;" align="left">
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/s6Xl76wp6-M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2009/08/creatingcustomviews/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2009/08/creatingcustomviews/</feedburner:origLink></item>
		<item>
		<title>Start Service at boot</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/kDrrY3Gv3E8/</link>
		<comments>http://www.androidcompetencycenter.com/2009/06/start-service-at-boot/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 13:04:15 +0000</pubDate>
		<dc:creator>zeeshan</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[boot complete]]></category>
		<category><![CDATA[BroadcastReceiver]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=406</guid>
		<description><![CDATA[Hello, Now we are going to learn how to start a service at boot time, i.e. to start our service when device starts up. First we have to create a BroadcastReceiver which will be started when boot completes as import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class MyStartupIntentReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, [...]]]></description>
				<content:encoded><![CDATA[<p>Hello,</p>
<p>Now we are going to learn how to start a service at boot time, i.e. to start our service when device starts up.</p>
<p>First we have to create a BroadcastReceiver which will be started when boot completes as</p>
<pre class="java">import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class MyStartupIntentReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
}
}</pre>
<p>onRecieve will be first called when the BroadcastReceiver MyStartupIntentReceiver starts.</p>
<p>Next make an entry of this receiver in AndroidManifest.xml as</p>
<pre class="xml">
&lt;receiver android:name="MyStartupIntentReceiver"&gt;
&lt;intent-filter&gt;
&lt;action
android:name="android.intent.action.BOOT_COMPLETED" /&gt;
&lt;category android:name="android.intent.category.HOME" /&gt;
&lt;/intent-filter&gt;
&lt;/receiver&gt;
</pre>
<p>Here in intent filter we have declared the action as android.intent.action.BOOT_COMPLETED , so that this receiver and intent with action android.intent.action.BOOT_COMPLETED</p>
<p>Now this receiver will be intimated when boot completes</p>
<p>Next if we want to start a service then the procedure is as follows</p>
<p>Create a Service as</p>
<pre  class="java">

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;

public class MyService extends Service {

	@Override
	public IBinder onBind(Intent intent) {

		return null;

	}

	@Override
	public void onCreate() {
		super.onCreate();

		Toast.makeText(this, "Service Created", Toast.LENGTH_LONG).show();

	}

	@Override
	public void onDestroy() {
		super.onDestroy();

		Toast.makeText(this, "Service Destroyed", Toast.LENGTH_LONG).show();

	}

	@Override
	public void onStart(Intent intent, int startId) {

		super.onStart(intent, startId);

		Toast.makeText(this, "Service Started", Toast.LENGTH_LONG).show();

	}
}
</pre>
<p>Make an entry of this service in AndroidManifest.xml as</p>
<pre class="xml"> 
&lt;service android:name="MyService"&gt;
&lt;intent-filter&gt;
&lt;action
android:name="com.wissen.startatboot.MyService" /&gt;
&lt;/intent-filter&gt;
&lt;/service&gt;
</pre>
<p>Now start this service in the BroadcastReceiver MyStartupIntentReceiver&#8217;s onReceive method as</p>
<pre class="java"> 
	public void onReceive(Context context, Intent intent) {
		Intent serviceIntent = new Intent();
		serviceIntent.setAction("com.wissen.startatboot.MyService");
		context.startService(serviceIntent);

	}

</pre>
<p>Next you can write the code that you want to execute when device boots up in the BroadcastReceiver or in the Service</p>
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/kDrrY3Gv3E8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2009/06/start-service-at-boot/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2009/06/start-service-at-boot/</feedburner:origLink></item>
		<item>
		<title>Accessing device Sensor’s</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/mNTr7aqphkU/</link>
		<comments>http://www.androidcompetencycenter.com/2009/06/accessing-device-sensors/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 07:02:58 +0000</pubDate>
		<dc:creator>zeeshan</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[accelerometer]]></category>
		<category><![CDATA[orientation]]></category>
		<category><![CDATA[sensor]]></category>
		<category><![CDATA[SensorManager]]></category>
		<category><![CDATA[SENSOR_SERVICE]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=402</guid>
		<description><![CDATA[Hello, Today we are going to learn how to access  sensor and retrieve data from it. First, to access device&#8217;s sensors we have to use  Class SensorManager(android.hardware.SensorManager). that lets you access the device&#8217;s sensors http://developer.android.com/reference/android/hardware/SensorManager.html To get SensorManager we have to use getSystemService(ServiceName) It returns handle to a system level service.Hence we get handle to [...]]]></description>
				<content:encoded><![CDATA[<p>Hello,</p>
<p>Today we are going to learn how to access  sensor and retrieve data from it.</p>
<p>First, to access device&#8217;s sensors we have to use  Class <strong>SensorManager(android.hardware.SensorManager)</strong>. that lets you access the device&#8217;s sensors</p>
<p><strong>http://developer.android.com/reference/android/hardware/SensorManager.html</strong></p>
<p>To get SensorManager we have to use <strong>getSystemService(ServiceName)</strong></p>
<p>It returns handle to a system level service.Hence we get handle to SensorManager as below</p>
<p><strong> </strong></p>
<pre class="java">//Declare Sensor Manager class object

private SensorManager mSensorManager;

//Next get the handle to the Sensor service

mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);</pre>
<p>Next declare a listener  for receiving notifications from the SensorManager when sensor values  have changed as.</p>
<pre class="java">
private final SensorListener sensorListener = new SensorListener(){
public void onSensorChanged(int sensor, float[] values)
{

//Retrieve the values from the float array values which contains sensor data
Float dataX = values[SensorManager.DATA_X];

Float dataY = values[SensorManager.DATA_Y];

Float dataZ = values[SensorManager.DATA_Z];

//Now we got the values and we can use it as we want

Log.i("X - Value",""+dataX);

Log.i("Y - Value",""+dataY);

Log.i("Z - Value",""+dataZ);

}

public void onAccuracyChanged(int sensor, int accuracy) {}

};</pre>
<p>For above listener to be notified of changed value we have to register it . We can register it in onResume as<strong></strong></p>
<pre class="java">
protected void onResume() {

super.onResume();

mSensorManager.registerListener(sensorListener,
SensorManager.SENSOR_ORIENTATION,
SensorManager.SENSOR_DELAY_GAME);
}
</pre>
<p>The syntax of register listener is as</p>
<pre class="java">
SensorManager.registerListener(SensorListener listener, int sensors, int rate)
</pre>
<p>We can unregister the sensorlistener in onStop as</p>
<pre class="java">
protected void onStop() {

super.onStop();

mSensorManager.unregisterListener(sensorListener);
}
</pre>
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/mNTr7aqphkU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2009/06/accessing-device-sensors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2009/06/accessing-device-sensors/</feedburner:origLink></item>
		<item>
		<title>Hello Android! – Presentation from talk at Pune GTUG</title>
		<link>http://feedproxy.google.com/~r/AndroidCompetencyCenter/~3/53Ckxwz8f8U/</link>
		<comments>http://www.androidcompetencycenter.com/2009/06/hello-android-presentation-from-talk-at-pune-gtug/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 11:53:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=397</guid>
		<description><![CDATA[We were invited by Pune Google Technology User Group (GTUG) to introduce developers to Android platform for application development. Our presentation went well and developers present liked it. Here is the presentation. Hello Android &#8211; Pune GTUG View more Keynote presentations from sushrutbidwai.]]></description>
				<content:encoded><![CDATA[<p>We were invited by Pune Google Technology User Group (GTUG) to introduce developers to Android platform for application development. Our presentation went well and developers present liked it. Here is the presentation.</p>
<div style="width:425px;text-align:left" id="__ss_1537938"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/sushrutbidwai/hello-android-pune-gtug?type=presentation" title="Hello Android - Pune GTUG">Hello Android &#8211; Pune GTUG</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=helloandroidpreso-090605082649-phpapp01&#038;stripped_title=hello-android-pune-gtug" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=helloandroidpreso-090605082649-phpapp01&#038;stripped_title=hello-android-pune-gtug" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">Keynote presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/sushrutbidwai">sushrutbidwai</a>.</div>
</div>
<img src="http://feeds.feedburner.com/~r/AndroidCompetencyCenter/~4/53Ckxwz8f8U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.androidcompetencycenter.com/2009/06/hello-android-presentation-from-talk-at-pune-gtug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.androidcompetencycenter.com/2009/06/hello-android-presentation-from-talk-at-pune-gtug/</feedburner:origLink></item>
	</channel>
</rss>
