<?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>CoderzHeaven &#187; Toggle Button</title>
	<atom:link href="http://www.coderzheaven.com/category/android/toggle-button/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.coderzheaven.com</link>
	<description>Heaven of all working Codes</description>
	<lastBuildDate>Thu, 16 May 2013 17:32:12 +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 find your Google Plus ID</title>
		<link>http://www.coderzheaven.com/2012/09/27/find-google-id/</link>
		<comments>http://www.coderzheaven.com/2012/09/27/find-google-id/#comments</comments>
		<pubDate>Thu, 27 Sep 2012 07:02:01 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Accelerometer]]></category>
		<category><![CDATA[ActionBars]]></category>
		<category><![CDATA[Adobe_AIR/FLEX]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[ANDROID]]></category>
		<category><![CDATA[Android Application Review]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[App Review]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Applet]]></category>
		<category><![CDATA[Blogger/Blogspot]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[C & C++]]></category>
		<category><![CDATA[Camera]]></category>
		<category><![CDATA[CheckBox]]></category>
		<category><![CDATA[Cocos2D]]></category>
		<category><![CDATA[Contacts]]></category>
		<category><![CDATA[Controls]]></category>
		<category><![CDATA[Core Java]]></category>
		<category><![CDATA[Corona SDK]]></category>
		<category><![CDATA[Download File]]></category>
		<category><![CDATA[Downloading files]]></category>
		<category><![CDATA[EditText]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Files]]></category>
		<category><![CDATA[Fixes]]></category>
		<category><![CDATA[Fun Games]]></category>
		<category><![CDATA[Gallery]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Google Plus]]></category>
		<category><![CDATA[GPS]]></category>
		<category><![CDATA[Hardware Buttons]]></category>
		<category><![CDATA[HTC]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Interview Questions]]></category>
		<category><![CDATA[iPad Application Review]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone Application Review]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JellyBean]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Layouts]]></category>
		<category><![CDATA[Lazy ListView]]></category>
		<category><![CDATA[Lists]]></category>
		<category><![CDATA[ListView]]></category>
		<category><![CDATA[Lua]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Memory]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MySpace]]></category>
		<category><![CDATA[NDK]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Notifications]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[PhoneGap]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Php Connection Android]]></category>
		<category><![CDATA[PHP-MYSQL Connections]]></category>
		<category><![CDATA[ProgressBar]]></category>
		<category><![CDATA[Samsung]]></category>
		<category><![CDATA[SDCARD]]></category>
		<category><![CDATA[SeekBar]]></category>
		<category><![CDATA[Serialization]]></category>
		<category><![CDATA[Services]]></category>
		<category><![CDATA[SONY]]></category>
		<category><![CDATA[SONY ERICSSON]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Styles]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Titanium]]></category>
		<category><![CDATA[Toggle Button]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Uploaing a File]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Webbrowser]]></category>
		<category><![CDATA[Widget]]></category>
		<category><![CDATA[Widgets]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[Find Google]]></category>
		<category><![CDATA[Profile Icon]]></category>
		<category><![CDATA[URL]]></category>

		<guid isPermaLink="false">http://www.coderzheaven.com/?p=4855</guid>
		<description><![CDATA[This is so simple 1. Go to your Google + account (https://plus.google.com/). 2. Click on the Profile icon on the Left. 3. If you look at the URL in the address bar, it should look something like this: https://plus.google.com/104653270154306099169/posts 4. The long numerical string in the URL is your Google+ ID. Here is CoderzHeaven&#8217;s from [...]<div class="crp_related"><h3><font color="#FF0000">More Similar Posts </font></h3><ul><li><a href="http://www.coderzheaven.com/2012/06/06/coderz-heaven-google/"     class="crp_title">Coderz Heaven in Google Plus</a></li><li><a href="http://www.coderzheaven.com/2011/07/16/how-to-create-a-vanity-url-for-google-plus/"     class="crp_title">How to create a Vanity URL for Google Plus ?</a></li><li><a href="http://www.coderzheaven.com/2011/07/15/how-to-enable-new-gmail-theme-similar-to-google-plus/"     class="crp_title">How to enable new gmail theme similar to google plus ?</a></li><li><a href="http://www.coderzheaven.com/2011/12/16/how-to-start-with-google-maps-in-android/"     class="crp_title">How to start with Google Maps in Android?</a></li><li><a href="http://www.coderzheaven.com/2011/07/15/how-to-invite-transfer-all-your-facebook-friends-to-google-plus/"     class="crp_title">How to invite / transfer all your facebook friends to google</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p>This is so simple </p>
<p>1. Go to your Google + account (https://plus.google.com/).</p>
<p>2. Click on the Profile icon on the Left.</p>
<p>3.  If you look at the URL in the address bar, it should look something like this:</p>
<blockquote><p>https://plus.google.com/104653270154306099169/posts</p></blockquote>
<p>4. The long numerical string in the URL is your Google+ ID. Here is CoderzHeaven&#8217;s from the URL above:</p>
<blockquote><p>104653270154306099169/</p></blockquote>
<p><a href='https://plus.google.com/104653270154306099169/posts'><img src="https://dl.dropboxusercontent.com/u/91846918/Google%20Plus/google%2Bcoderz.png" alt="Google + CoderzHeaven" /></a></p>
<div class="su-linkbox" id="post-4855-linkbox"><div class="su-linkbox-label">Link to this post!</div><div class="su-linkbox-field"><input type="text" value="&lt;a href=&quot;http://www.coderzheaven.com/2012/09/27/find-google-id/&quot;&gt;How to find your Google Plus ID&lt;/a&gt;" onclick="javascript:this.select()" readonly="readonly" style="width: 100%;" /></div></div><div class="crp_related"><h3><font color="#FF0000">More Similar Posts </font></h3><ul><li><a href="http://www.coderzheaven.com/2012/06/06/coderz-heaven-google/"     class="crp_title">Coderz Heaven in Google Plus</a></li><li><a href="http://www.coderzheaven.com/2011/07/16/how-to-create-a-vanity-url-for-google-plus/"     class="crp_title">How to create a Vanity URL for Google Plus ?</a></li><li><a href="http://www.coderzheaven.com/2011/07/15/how-to-enable-new-gmail-theme-similar-to-google-plus/"     class="crp_title">How to enable new gmail theme similar to google plus ?</a></li><li><a href="http://www.coderzheaven.com/2011/12/16/how-to-start-with-google-maps-in-android/"     class="crp_title">How to start with Google Maps in Android?</a></li><li><a href="http://www.coderzheaven.com/2011/07/15/how-to-invite-transfer-all-your-facebook-friends-to-google-plus/"     class="crp_title">How to invite / transfer all your facebook friends to google</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.coderzheaven.com/2012/09/27/find-google-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a Custom Toggle Button in android?</title>
		<link>http://www.coderzheaven.com/2012/05/20/create-custom-toggle-button-android/</link>
		<comments>http://www.coderzheaven.com/2012/05/20/create-custom-toggle-button-android/#comments</comments>
		<pubDate>Sun, 20 May 2012 03:47:36 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[ANDROID]]></category>
		<category><![CDATA[Toggle Button]]></category>
		<category><![CDATA[android:buttonStyleToggle]]></category>
		<category><![CDATA[android:disabledAlpha]]></category>
		<category><![CDATA[android:textOff]]></category>
		<category><![CDATA[android:textOn]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[Bg]]></category>
		<category><![CDATA[Btn]]></category>
		<category><![CDATA[Button Toggles]]></category>
		<category><![CDATA[Custom Button]]></category>
		<category><![CDATA[Hello Everyone]]></category>
		<category><![CDATA[How to create a Custom Toggle Button in android?]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[LinearLayout]]></category>
		<category><![CDATA[Lt Xml]]></category>
		<category><![CDATA[Orientation]]></category>
		<category><![CDATA[Res]]></category>
		<category><![CDATA[Resource Definition]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[ToggleButton]]></category>
		<category><![CDATA[Transparent]]></category>
		<category><![CDATA[Utf 8]]></category>
		<category><![CDATA[Widget.Button.Toggle]]></category>
		<category><![CDATA[Xml Create]]></category>
		<category><![CDATA[Xmlns]]></category>

		<guid isPermaLink="false">http://www.coderzheaven.com/?p=4266</guid>
		<description><![CDATA[Hello everyone&#8230; In today&#8217;s tutorial I will show you how to create a custom toggle button in android. Often in our applications we don&#8217;t need a default toggle button, so I will show you how to change that to make a toggle button according to your need. First I will create a fresh project named [...]<div class="crp_related"><h3><font color="#FF0000">More Similar Posts </font></h3><ul><li><a href="http://www.coderzheaven.com/2011/07/20/how-to-create-a-transparent-activity-in-android/"     class="crp_title">How to create a transparent activity in android?</a></li><li><a href="http://www.coderzheaven.com/2012/04/17/inherit-styles-extend-styles-android/"     class="crp_title">How to inherit from other styles or how to extend your own&hellip;</a></li><li><a href="http://www.coderzheaven.com/2012/01/16/controlling-android-emulator-with-keypad/"     class="crp_title">Controlling android emulator with keypad.</a></li><li><a href="http://www.coderzheaven.com/2012/03/29/custom-indeterminate-progressbar-for-android/"     class="crp_title">Custom Indeterminate progressBar for android?</a></li><li><a href="http://www.coderzheaven.com/2012/02/03/changing-the-style-or-theme-of-default-alertdialog-in-android/"     class="crp_title">Changing the style or theme of default alertDialog in&hellip;</a></li></ul></div>]]></description>
				<content:encoded><![CDATA[<p>Hello everyone&#8230;</p>
<p>In today&#8217;s tutorial I will show you how to create a custom toggle button in android. Often in our applications we don&#8217;t need a default toggle button, so I will show you how to change that to make a <a href="http://www.coderzheaven.com/2012/05/23/create-customprogressbar-android-part-3/" title="Custom progressbar" target="_blank">toggle button</a> according to your need.</p>
<p>First I will create a fresh project named &#8220;CustomToggleButton&#8221; and name the main activity &#8220;CustomToggleButtonDemo&#8221;.</p>
<p>Now These are the two images that I am using to create the toggle button.</p>
<p><img src="https://dl.dropboxusercontent.com/u/91846918/Toggle%20Button/add_icon.png" alt="add icon" /></p>
<p><img src="https://dl.dropboxusercontent.com/u/91846918/Toggle%20Button/delete_icon.png" alt="delete icon" /></p>
<p>First the layout file main.xml that contains the toggle button.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:orientation=&quot;vertical&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    &gt;
&lt;TextView  
    android:layout_width=&quot;fill_parent&quot; 
    android:layout_height=&quot;wrap_content&quot; 
    android:text=&quot;@string/hello&quot;
    /&gt;
&lt;ToggleButton 
	android:background=&quot;@drawable/btn_toggle_bg&quot;
	style=&quot;@style/OurThemeName&quot; 
	android:checked=&quot;true&quot;
	android:id=&quot;@+id/ToggleButton01&quot; 
	android:layout_width=&quot;wrap_content&quot; 
	android:layout_height=&quot;wrap_content&quot;&gt;
&lt;/ToggleButton&gt;

&lt;/LinearLayout&gt;
</pre>
<p>This will create a toggle button.</p>
<p>Now we will make an xml that contains the resource definition that applies when the button toggles and the background of the button.<br />
We will make the button background transparent and for toggle action we will create another xml that contains the &#8220;on&#8221; and &#8220;off&#8221; resource for the button.</p>
<p>Create a new file inside the drawable folder and name it &#8220;btn_toggle_bg.xml&#8221; and copy this code to it.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;layer-list xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
    &lt;item android:id=&quot;@+android:id/background&quot; android:drawable=&quot;@android:color/transparent&quot; /&gt;
    &lt;item android:id=&quot;@+android:id/toggle&quot; android:drawable=&quot;@drawable/btn_toggle&quot; /&gt;
&lt;/layer-list&gt;
</pre>
<p>Now create another xml inside the drawable folder and name it &#8220;btn_toggle.xml&#8221; and it contains &#8230;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
    &lt;item android:state_checked=&quot;true&quot; android:drawable=&quot;@drawable/add_icon&quot; /&gt;
    &lt;item android:state_checked=&quot;false&quot; android:drawable=&quot;@drawable/delete_icon&quot; /&gt;
&lt;/selector&gt;
</pre>
<p>This means that when the button is on(true) the image will be &#8220;add_icon.png&#8221; and when &#8220;off&#8221; the image will be &#8220;delete_icon.png&#8221;.</p>
<p>Now we are going to write a theme that is to be applied to the toggle button that overrides the default android theme.</p>
<p>Create a new file called &#8220;themes.xml&#8221; inside the strings folder and copy this code to it.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;resources&gt;
&lt;!-- Overwrite the ToggleButton style --&gt;
&lt;style name=&quot;Widget.Button.Toggle&quot; parent=&quot;android:Widget&quot;&gt;
    &lt;item name=&quot;android:background&quot;&gt;@drawable/btn_toggle_bg&lt;/item&gt;
    &lt;item name=&quot;android:textOn&quot;&gt;Add&lt;/item&gt;
    &lt;item name=&quot;android:textOff&quot;&gt;Del&lt;/item&gt;
    &lt;item name=&quot;android:disabledAlpha&quot;&gt;?android:attr/disabledAlpha&lt;/item&gt;
&lt;/style&gt;

&lt;style name=&quot;OurThemeName&quot;  parent=&quot;@android:Theme.Black&quot;&gt;
    &lt;item name=&quot;android:buttonStyleToggle&quot;&gt;@style/Widget.Button.Toggle&lt;/item&gt;
      &lt;item name=&quot;android:textOn&quot;&gt;&lt;/item&gt;
    &lt;item name=&quot;android:textOff&quot;&gt;&lt;/item&gt;
&lt;/style&gt;
&lt;/resources&gt;
</pre>
<p>Please look at the main.xml file where this theme has been applied.</p>
<p>Here</p>
<pre class="brush: xml; title: ; notranslate">
&lt;ToggleButton 
	android:background=&quot;@drawable/btn_toggle_bg&quot;
	&lt;strong&gt;style=&quot;@style/OurThemeName&quot; &lt;/strong&gt;
	android:checked=&quot;true&quot;
	android:id=&quot;@+id/ToggleButton01&quot; 
	android:layout_width=&quot;wrap_content&quot; 
	android:layout_height=&quot;wrap_content&quot;&gt;
&lt;/ToggleButton&gt;
</pre>
<p>OK now our custom toggle button is ready. Go on and run it.</p>
<p><img src="https://dl.dropboxusercontent.com/u/91846918/Toggle%20Button/custom_toggle_button_1.png" alt="Custom toggle button" /></p>
<p><img src="https://dl.dropboxusercontent.com/u/91846918/Toggle%20Button/custom_toggle_button_2.png" alt="Custom toggle button" /></p>
<p>Actually we dont need the activity java file because everything can be done in the xml itself.</p>
<p>Download the complete source code from <a href="http://coderzheaven.com/uploads/CustomToggleButton.rar">here</a>.</p>
<div class="su-linkbox" id="post-4266-linkbox"><div class="su-linkbox-label">Link to this post!</div><div class="su-linkbox-field"><input type="text" value="&lt;a href=&quot;http://www.coderzheaven.com/2012/05/20/create-custom-toggle-button-android/&quot;&gt;How to create a Custom Toggle Button in android?&lt;/a&gt;" onclick="javascript:this.select()" readonly="readonly" style="width: 100%;" /></div></div><div class="crp_related"><h3><font color="#FF0000">More Similar Posts </font></h3><ul><li><a href="http://www.coderzheaven.com/2011/07/20/how-to-create-a-transparent-activity-in-android/"     class="crp_title">How to create a transparent activity in android?</a></li><li><a href="http://www.coderzheaven.com/2012/04/17/inherit-styles-extend-styles-android/"     class="crp_title">How to inherit from other styles or how to extend your own&hellip;</a></li><li><a href="http://www.coderzheaven.com/2012/01/16/controlling-android-emulator-with-keypad/"     class="crp_title">Controlling android emulator with keypad.</a></li><li><a href="http://www.coderzheaven.com/2012/03/29/custom-indeterminate-progressbar-for-android/"     class="crp_title">Custom Indeterminate progressBar for android?</a></li><li><a href="http://www.coderzheaven.com/2012/02/03/changing-the-style-or-theme-of-default-alertdialog-in-android/"     class="crp_title">Changing the style or theme of default alertDialog in&hellip;</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.coderzheaven.com/2012/05/20/create-custom-toggle-button-android/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
