<?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/" version="2.0">

<channel>
	<title>Android Tutorial | Android SDK Development &amp; Programming</title>
	
	<link>http://www.edumobile.org/android</link>
	<description />
	<lastBuildDate>Thu, 16 May 2013 12:52:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AndroidTutorialAndroidSdkDevelopmentProgrammingTutorial" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="androidtutorialandroidsdkdevelopmentprogrammingtutorial" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Animation Reverse Example in Android</title>
		<link>http://www.edumobile.org/android/android-sdk-tutorial/animation-reverse-example-in-android/</link>
		<comments>http://www.edumobile.org/android/android-sdk-tutorial/animation-reverse-example-in-android/#comments</comments>
		<pubDate>Thu, 16 May 2013 10:32:45 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Android Beginner Tutorials]]></category>
		<category><![CDATA[ANDROID SDK TUTORIAL]]></category>
		<category><![CDATA[Android Animation Reverse Example]]></category>
		<category><![CDATA[Android app tutorial]]></category>
		<category><![CDATA[Animation Reverse]]></category>
		<category><![CDATA[Animation Reverse Example]]></category>
		<category><![CDATA[Animation Reverse Example code]]></category>
		<category><![CDATA[Animation Reverse Example in Android]]></category>
		<category><![CDATA[free android tutorial]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=1854</guid>
		<description><![CDATA[This example shows how to animate an object and play the animation in reverse in android. Algorithm: 1.) Create a new project by File-> New -> Android Project name it AnimationReverseExample. 2.) Create and write following into src/ShapeHolder.java: 3.) Write following into activity_animation_reverse_example.xml: 4.) Run for output. Steps: 1.) Create a project named AnimationReverseExample and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/thumb1.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/thumb1-150x150.jpg" alt="" title="thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-1861" /></a>This example shows how to animate an object and play the animation in reverse in android.</p>
<p>Algorithm:</p>
<p>1.)	Create a new project by File-> New -> Android Project name it AnimationReverseExample.</p>
<p>2.)	Create and write following into src/ShapeHolder.java:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.animationreverseexample;

import android.graphics.Paint;
import android.graphics.RadialGradient;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.Shape;

public class ShapeHolder {
    private float x = 0, y = 0;
    private ShapeDrawable shape;
    private int color;
    private RadialGradient gradient;
    private float alpha = 1f;
    private Paint paint;

    public void setPaint(Paint value) {
        paint = value;
    }
    public Paint getPaint() {
        return paint;
    }

    public void setX(float value) {
        x = value;
    }
    public float getX() {
        return x;
    }
    public void setY(float value) {
        y = value;
    }
    public float getY() {
        return y;
    }
    public void setShape(ShapeDrawable value) {
        shape = value;
    }
    public ShapeDrawable getShape() {
        return shape;
    }
    public int getColor() {
        return color;
    }
    public void setColor(int value) {
        shape.getPaint().setColor(value);
        color = value;
    }
    public void setGradient(RadialGradient value) {
        gradient = value;
    }
    public RadialGradient getGradient() {
        return gradient;
    }

    public void setAlpha(float alpha) {
        this.alpha = alpha;
        shape.setAlpha((int)((alpha * 255f) + .5f));
    }

    public float getWidth() {
        return shape.getShape().getWidth();
    }
    public void setWidth(float width) {
        Shape s = shape.getShape();
        s.resize(width, s.getHeight());
    }

    public float getHeight() {
        return shape.getShape().getHeight();
    }
    public void setHeight(float height) {
        Shape s = shape.getShape();
        s.resize(s.getWidth(), height);
    }

    public ShapeHolder(ShapeDrawable s) {
        shape = s;
    }
}
</pre>
<p>3.)	Write following into activity_animation_reverse_example.xml:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:orientation=&quot;vertical&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot;
    android:id=&quot;@+id/container&quot;
    &gt;
    &lt;LinearLayout
        android:orientation=&quot;horizontal&quot;
        android:layout_width=&quot;match_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        &gt;
        &lt;Button
            android:layout_width=&quot;wrap_content&quot;
            android:layout_height=&quot;wrap_content&quot;
            android:text=&quot;Play&quot;
            android:id=&quot;@+id/startButton&quot;
            /&gt;
        &lt;Button
            android:layout_width=&quot;wrap_content&quot;
            android:layout_height=&quot;wrap_content&quot;
            android:text=&quot;Reverse&quot;
            android:id=&quot;@+id/reverseButton&quot;
            /&gt;
    &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</pre>
<p>4.)	Run for output.</p>
<p>Steps:</p>
<p>1.) Create a project named AnimationReverseExample and set the information as stated in the image.</p>
<p>	Build Target: Android 4.0<br />
	Application Name: AnimationReverseExample<br />
	Package Name: com. example. AnimationReverseExample<br />
	Activity Name: AnimationReverseExample<br />
	Min SDK Version: 11</p>
<p> <a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample1.png" alt="" title="animationreverseexample1" width="566" height="323" class="alignnone size-full wp-image-1855" /></a></p>
<p>2.) Open AnimationReverseExample.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.animationreverseexample;

import java.util.ArrayList;

import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RadialGradient;
import android.graphics.Shader;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.widget.Button;
import android.widget.LinearLayout;

public class AnimationReverseExample extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_animation_reverse_example);
        LinearLayout container = (LinearLayout) findViewById(R.id.container);
        final MyAnimationView animView = new MyAnimationView(this);
        container.addView(animView);

        Button starter = (Button) findViewById(R.id.startButton);
        starter.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                animView.startAnimation();
            }
        });

        Button reverser = (Button) findViewById(R.id.reverseButton);
        reverser.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                animView.reverseAnimation();
            }
        });

    }

    public class MyAnimationView extends View implements ValueAnimator.AnimatorUpdateListener {

        public final ArrayList&lt;ShapeHolder&gt; balls = new ArrayList&lt;ShapeHolder&gt;();
        ValueAnimator bounceAnim = null;
        ShapeHolder ball = null;

        public MyAnimationView(Context context) {
            super(context);
            ball = createBall(25, 25);
        }

        private void createAnimation() {
            if (bounceAnim == null) {
                bounceAnim = ObjectAnimator.ofFloat(ball, &quot;y&quot;, ball.getY(), getHeight() - 50f).
                        setDuration(1500);
                bounceAnim.setInterpolator(new AccelerateInterpolator(2f));
                bounceAnim.addUpdateListener(this);
            }
        }

        public void startAnimation() {
            createAnimation();
            bounceAnim.start();
        }

        public void reverseAnimation() {
            createAnimation();
            bounceAnim.reverse();
        }

        public void seek(long seekTime) {
            createAnimation();
            bounceAnim.setCurrentPlayTime(seekTime);
        }

        private ShapeHolder createBall(float x, float y) {
            OvalShape circle = new OvalShape();
            circle.resize(50f, 50f);
            ShapeDrawable drawable = new ShapeDrawable(circle);
            ShapeHolder shapeHolder = new ShapeHolder(drawable);
            shapeHolder.setX(x - 25f);
            shapeHolder.setY(y - 25f);
            int color = 0xffFF0000;
            Paint paint = drawable.getPaint(); //new Paint(Paint.ANTI_ALIAS_FLAG);
            int darkColor = 0xffFF0000;
            RadialGradient gradient = new RadialGradient(37.5f, 12.5f,
                    50f, color, darkColor, Shader.TileMode.CLAMP);
            paint.setShader(gradient);
            shapeHolder.setPaint(paint);
            return shapeHolder;
        }

        @Override
        protected void onDraw(Canvas canvas) {
            canvas.save();
            canvas.translate(ball.getX(), ball.getY());
            ball.getShape().draw(canvas);
            canvas.restore();
        }

        public void onAnimationUpdate(ValueAnimator animation) {
            invalidate();
        }

    }
} 
</pre>
<p>3.) Compile and build the project.</p>
<p>Output</p>
<p> <a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample2.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample2-300x270.png" alt="" title="animationreverseexample2" width="300" height="270" class="alignnone size-medium wp-image-1856" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample3.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample3-300x270.png" alt="" title="animationreverseexample3" width="300" height="270" class="alignnone size-medium wp-image-1857" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample4.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample4-300x270.png" alt="" title="animationreverseexample4" width="300" height="270" class="alignnone size-medium wp-image-1858" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample5.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample5-300x269.png" alt="" title="animationreverseexample5" width="300" height="269" class="alignnone size-medium wp-image-1859" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample6.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/animationreverseexample6-300x270.png" alt="" title="animationreverseexample6" width="300" height="270" class="alignnone size-medium wp-image-1860" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-sdk-tutorial/animation-reverse-example-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote Service Client Example</title>
		<link>http://www.edumobile.org/android/android-apps/remote-service-client-example/</link>
		<comments>http://www.edumobile.org/android/android-apps/remote-service-client-example/#comments</comments>
		<pubDate>Sat, 11 May 2013 09:32:58 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Android Apps]]></category>
		<category><![CDATA[Android Programming Tutorials]]></category>
		<category><![CDATA[Remote Service Client]]></category>
		<category><![CDATA[Remote Service Client Android]]></category>
		<category><![CDATA[Remote Service Client Android programming]]></category>
		<category><![CDATA[Remote Service Client Example]]></category>
		<category><![CDATA[Remote Service Client Example Android tutorials]]></category>
		<category><![CDATA[Remote Service Client in Android programming]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=2440</guid>
		<description><![CDATA[This example will show you how to handle and invoke remote service from client. Algorithm: 1.) Create a new project by File-> New -> Android Project name it RemoteServiceClientExample. 2.) Write following into main.xml: 3.) Import com.example.remoteserviceexample into src. (check another blogpost RemoteServiceExample for this) 4.) Run for output. Steps: 1.) Create a project named [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2013/05/thumb.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2013/05/thumb-150x150.jpg" alt="" title="thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-2442" /></a>This example will show you how to handle and invoke remote service from client.</p>
<p>Algorithm:</p>
<p>1.)	Create a new project by File-> New -> Android Project name it RemoteServiceClientExample.</p>
<p>2.)	Write following into main.xml:<br />
<br/></p>
<pre class="brush: java; 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/welcome&quot;
    /&gt;
&lt;Button android:id=&quot;@+id/startButton&quot;
	android:text=&quot;@string/startButton&quot;
	android:layout_gravity=&quot;center_horizontal&quot;
	android:layout_width=&quot;wrap_content&quot;
	android:layout_height=&quot;wrap_content&quot;
	&gt;
	&lt;/Button&gt;
&lt;Button android:id=&quot;@+id/stopButton&quot;
	android:text=&quot;@string/stopButton&quot;
	android:layout_gravity=&quot;center_horizontal&quot;
	android:layout_width=&quot;wrap_content&quot;
	android:layout_height=&quot;wrap_content&quot;
	&gt;
	&lt;/Button&gt;
&lt;Button android:id=&quot;@+id/bindButton&quot;
	android:text=&quot;@string/bindButton&quot;
	android:layout_gravity=&quot;center_horizontal&quot;
	android:layout_width=&quot;wrap_content&quot;
	android:layout_height=&quot;wrap_content&quot;
	&gt;
	&lt;/Button&gt;
&lt;Button android:id=&quot;@+id/releaseButton&quot;
	android:text=&quot;@string/releaseButton&quot;
	android:layout_gravity=&quot;center_horizontal&quot;
	android:layout_width=&quot;wrap_content&quot;
	android:layout_height=&quot;wrap_content&quot;
	&gt;
	&lt;/Button&gt;
&lt;Button android:id=&quot;@+id/invokeButton&quot;
	android:text=&quot;@string/invokeButton&quot;
	android:layout_gravity=&quot;center_horizontal&quot;
	android:layout_width=&quot;wrap_content&quot;
	android:layout_height=&quot;wrap_content&quot;
	&gt;
	&lt;/Button&gt;
&lt;TextView android:id=&quot;@+id/notApplicable&quot;
	android:layout_width=&quot;wrap_content&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:text=&quot;@string/notApplicable&quot; /&gt;	
&lt;TextView android:id=&quot;@+id/serviceStatus&quot;
	android:layout_width=&quot;wrap_content&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:text=&quot;@string/serviceStatus&quot; /&gt;

&lt;/LinearLayout&gt;
</pre>
<p>3.)	Import com.example.remoteserviceexample into src. (check another blogpost RemoteServiceExample for this)<br />
4.)	Run for output.</p>
<p>Steps:</p>
<p>1.) Create a project named RemoteServiceClientExample and set the information as stated in the image.</p>
<p>	Build Target: Android 4.2<br />
	Application Name: RemoteServiceClientExample<br />
	Package Name: com. RemoteServiceClientExample<br />
	Activity Name: RemoteServiceClientExample<br />
	Min SDK Version: 4.2</p>
<p>2.) Open RemoteServiceClientExample.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.remoteserviceclient;

import com.example.remoteserviceexample.IMyRemoteService;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class RemoteServiceClientExample extends Activity {
	private IMyRemoteService remoteService;
	private boolean started = false;
	private RemoteServiceConnection conn = null;
	
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Button start = (Button)findViewById(R.id.startButton);
        Button stop = (Button)findViewById(R.id.stopButton);
        Button bind = (Button)findViewById(R.id.bindButton);
        Button release = (Button)findViewById(R.id.releaseButton);
        Button invoke = (Button)findViewById(R.id.invokeButton);
        
        start.setOnClickListener(new OnClickListener() {
        	public void onClick(View v){
        		startService();
        	}
        });
        
        stop.setOnClickListener(new OnClickListener() {
        	public void onClick(View v){
        		stopService();
        	}
        });       
        
        bind.setOnClickListener(new OnClickListener() {
        	public void onClick(View v){
        		bindService();
        	}
        });  
        
        release.setOnClickListener(new OnClickListener() {
        	public void onClick(View v){
        		releaseService();
        	}
        });          
        
        invoke.setOnClickListener(new OnClickListener() {
        	public void onClick(View v){
        		invokeService();
        	}
        });          

   
    }
    
    private void startService(){
       		if (started) {
       			Toast.makeText(RemoteServiceClientExample.this, &quot;Service already started&quot;, Toast.LENGTH_SHORT).show();
       		} else {
       			Intent i = new Intent();
       			i.setClassName(&quot;com.example.remoteserviceexample&quot;, &quot;com.example.remoteserviceexample.RemoteService&quot;);
       			startService(i);
       			started = true;
       			updateServiceStatus();
       			Log.d( getClass().getSimpleName(), &quot;startService()&quot; );
       		}
       		
    }
       
    private void stopService() {
      		if (!started) {
       			Toast.makeText(RemoteServiceClientExample.this, &quot;Service not yet started&quot;, Toast.LENGTH_SHORT).show();
      		} else {
       			Intent i = new Intent();
       			i.setClassName(&quot;com.example.remoteserviceexample&quot;, &quot;com.example.remoteserviceexample.RemoteService&quot;);
       			stopService(i);
       			started = false;
       			updateServiceStatus();
       			Log.d( getClass().getSimpleName(), &quot;stopService()&quot; );
      		}
    }
      
    private void bindService() {
        		if(conn == null) {
        			conn = new RemoteServiceConnection();
        			Intent i = new Intent();
        			i.setClassName(&quot;com.example.remoteserviceexample&quot;, &quot;com.example.remoteserviceexample.RemoteService&quot;);
        			bindService(i, conn, Context.BIND_AUTO_CREATE);
        			updateServiceStatus();
        			Log.d( getClass().getSimpleName(), &quot;bindService()&quot; );
        		} else {
        	        Toast.makeText(RemoteServiceClientExample.this, &quot;Cannot bind - service already bound&quot;, Toast.LENGTH_SHORT).show();
        		}
    }
        
    private void releaseService() {
        		if(conn != null) {
        			unbindService(conn);
        			conn = null;
        			updateServiceStatus();
        			Log.d( getClass().getSimpleName(), &quot;releaseService()&quot; );
        		} else {
        			Toast.makeText(RemoteServiceClientExample.this, &quot;Cannot unbind - service not bound&quot;, Toast.LENGTH_SHORT).show();
        		}
    }
        
    private void invokeService() {
        		if(conn == null) {
        			Toast.makeText(RemoteServiceClientExample.this, &quot;Cannot invoke - service not bound&quot;, Toast.LENGTH_SHORT).show();
        		} else {
        			try {
        				int counter = remoteService.getCounter();
        				  TextView t = (TextView)findViewById(R.id.notApplicable);
        				  t.setText( &quot;Counter value: &quot;+Integer.toString( counter ) );
        				  Log.d( getClass().getSimpleName(), &quot;invokeService()&quot; );
        			} catch (RemoteException re) {
        				Log.e( getClass().getSimpleName(), &quot;RemoteException&quot; );
        			}
        		}
       	}	        	

      
      class RemoteServiceConnection implements ServiceConnection {
          public void onServiceConnected(ComponentName className, 
  			IBinder boundService ) {
            remoteService = IMyRemoteService.Stub.asInterface((IBinder)boundService);
            Log.d( getClass().getSimpleName(), &quot;onServiceConnected()&quot; );
          }

          public void onServiceDisconnected(ComponentName className) {
            remoteService = null;
  		   updateServiceStatus();
  		   Log.d( getClass().getSimpleName(), &quot;onServiceDisconnected&quot; );
          }
      };
      
      private void updateServiceStatus() {
    	  String bindStatus = conn == null ? &quot;unbound&quot; : &quot;bound&quot;;
    	  String startStatus = started ? &quot;started&quot; : &quot;not started&quot;;
    	  String statusText = &quot;Service status: &quot;+
    							bindStatus+
    							&quot;,&quot;+
    							startStatus;
    	  TextView t = (TextView)findViewById( R.id.serviceStatus);
    	  t.setText( statusText );	  
    	}
      
      protected void onDestroy() {
    	  super.onDestroy();
    	  releaseService();
    	  Log.d( getClass().getSimpleName(), &quot;onDestroy()&quot; );
      }
 }
</pre>
<p>5.)	Compile and build the project.</p>
<p>  Output</p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2013/05/remoteserviceclientexample1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2013/05/remoteserviceclientexample1.png" alt="" title="remoteserviceclientexample1" width="451" height="537" class="alignnone size-full wp-image-2441" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-apps/remote-service-client-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>External App Launcher in Android</title>
		<link>http://www.edumobile.org/android/android-game-programming/external-app-launcher-in-android/</link>
		<comments>http://www.edumobile.org/android/android-game-programming/external-app-launcher-in-android/#comments</comments>
		<pubDate>Tue, 07 May 2013 10:55:32 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Android Game Programming]]></category>
		<category><![CDATA[Android app tutorial]]></category>
		<category><![CDATA[android tutorial]]></category>
		<category><![CDATA[android tutorials]]></category>
		<category><![CDATA[External App Launcher]]></category>
		<category><![CDATA[External App Launcher android]]></category>
		<category><![CDATA[External App Launcher example]]></category>
		<category><![CDATA[ExternalAppLauncher]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=2154</guid>
		<description><![CDATA[This example will show how you can read Rss feeds from your activity. Algorithm: 1.) Create a new project by File-> New -> Android Project name it ExternalAppLauncher. 2.) Write following into strings.xml: 3.) Write following into res/layout/appview.xml: 4.) Write following into main.xml: 5.) Create and write following into src/AppLauncher.java: 6.) Create and Write following [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/11/thumb2.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/11/thumb2-150x142.jpg" alt="" title="thumb" width="150" height="142" class="alignleft size-thumbnail wp-image-2158" /></a>This example will show how you can read Rss feeds from your activity.</p>
<p>Algorithm:</p>
<p>1.)	Create a new project by File-> New -> Android Project name it ExternalAppLauncher.</p>
<p>2.)	Write following into strings.xml:<br />
</br></p>
<pre class="brush: java; title: ; notranslate">
&lt;resources&gt;

    &lt;string name=&quot;app_name&quot;&gt;ExternalAppLauncher&lt;/string&gt;
    &lt;string name=&quot;hello_world&quot;&gt;Hello world!&lt;/string&gt;
    &lt;string name=&quot;menu_settings&quot;&gt;Settings&lt;/string&gt;
    &lt;string name=&quot;title_activity_external_app_launcher&quot;&gt;ExternalAppLauncherActivity&lt;/string&gt;
	&lt;string name=&quot;app_desc&quot;&gt;Example application to show how to enumerate and launch external application&lt;/string&gt;
	&lt;string name=&quot;menu_about&quot;&gt;About&lt;/string&gt;
	&lt;string name=&quot;menu_about_desc&quot;&gt;About App Launcher&lt;/string&gt;
&lt;/resources&gt;
</pre>
<p>3.)	Write following into res/layout/appview.xml:</p>
<pre class="brush: java; 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:layout_width=&quot;fill_parent&quot;
        android:layout_height=&quot;wrap_content&quot;&gt;
        
        &lt;ImageView
                android:id=&quot;@+id/app_icon&quot;
                android:layout_width=&quot;48px&quot;
                android:layout_height=&quot;48px&quot;
                android:padding=&quot;3px&quot;
                android:scaleType=&quot;fitXY&quot;/&gt;
        
        &lt;LinearLayout
                android:layout_width=&quot;fill_parent&quot;
                android:layout_height=&quot;fill_parent&quot;&gt;
                
                &lt;TextView
                        android:id=&quot;@+id/app_name&quot;
                        android:layout_width=&quot;fill_parent&quot;
                        android:layout_height=&quot;fill_parent&quot;
                        android:gravity=&quot;center_vertical&quot;/&gt;
        
        &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</pre>
<p>4.)	Write following into main.xml:</p>
<pre class="brush: java; 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;ListView 
            android:layout_width=&quot;fill_parent&quot; 
            android:layout_height=&quot;wrap_content&quot;
            android:id=&quot;@android:id/list&quot;/&gt;
            
&lt;/LinearLayout&gt;
</pre>
<p>5.)	Create and write following into src/AppLauncher.java:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.externalapplauncher;

import android.app.Application;
import android.content.res.Configuration;

public class AppLauncher extends Application 
{
        @Override
        public void onConfigurationChanged(Configuration newConfig) {
                super.onConfigurationChanged(newConfig);
        }

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

        @Override
        public void onLowMemory() {
                super.onLowMemory();
        }

        @Override
        public void onTerminate() {
                super.onTerminate();
        }
}
</pre>
<p>6.)	Create and Write following into res/menu/menu.xml:</p>
<pre class="brush: java; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;menu
  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
&lt;item android:id=&quot;@+id/menu_about&quot; android:titleCondensed=&quot;@string/menu_about&quot; android:title=&quot;@string/menu_about_desc&quot; android:icon=&quot;@android:drawable/ic_menu_help&quot;&gt;&lt;/item&gt;
&lt;/menu&gt;
</pre>
<p>7.)	Run for output.</p>
<p>Steps:</p>
<p>1.) Create a project named ExternalAppLauncher and set the information as stated in the image.</p>
<p>	Build Target: Android 4.0<br />
	Application Name: ExternalAppLauncher<br />
	Package Name: com. example. ExternalAppLauncher<br />
	Activity Name: ExternalAppLauncherActivity<br />
	Min SDK Version: 2.2</p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/11/externalapplauncher.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/11/externalapplauncher-1024x613.png" alt="" title="externalapplauncher" width="524" height="313" class="alignnone size-large wp-image-2157" /></a></p>
<p>2.) Open ExternalAppLauncher.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.externalapplauncher;

import java.util.ArrayList;
import java.util.List;

import android.app.AlertDialog;
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class ExternalAppLauncherActivity extends ListActivity {
    PackageManager packageManager = null;
    List&lt;ApplicationInfo&gt; applist = null;
    ApplicationAdaptor listadaptor = null;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    
    packageManager = getPackageManager();
    
    new LoadApplicationTask().execute();
}

public boolean onCreateOptionsMenu(Menu menu) {
            MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu, menu);
        
            return true;
    }

public boolean onOptionsItemSelected(MenuItem item) {
    boolean result = true;
    
            switch(item.getItemId())
            {
                    case R.id.menu_about:
                    {
                            displayAboutDialog();
                            
                            break;
                    }
                    default:
                    {
                            result = super.onOptionsItemSelected(item);
                            
                            break;
                    }
            }
            
            return result;

}


private void displayAboutDialog()
    {
    final AlertDialog.Builder builder = new AlertDialog.Builder(this);

    builder.setTitle(getString(R.string.app_name));
    builder.setMessage(getString(R.string.app_desc));
    
    builder.show();
    }
    
@Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
            super.onListItemClick(l, v, position, id);
            
            ApplicationInfo app = applist.get(position);
            try 
            {
                    Intent intent = packageManager.getLaunchIntentForPackage(app.packageName);
                    
                    if(null != intent)
                    {
                            startActivity(intent);
                    }
            } 
            catch (ActivityNotFoundException e)
            {
                    Toast.makeText(ExternalAppLauncherActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
            }
            catch (Exception e) 
            {
                    Toast.makeText(ExternalAppLauncherActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
            }
    }

private List&lt;ApplicationInfo&gt; checkForLaunchIntent(List&lt;ApplicationInfo&gt; list)
{
    ArrayList&lt;ApplicationInfo&gt; applist = new ArrayList&lt;ApplicationInfo&gt;(); 
    
    for(ApplicationInfo info: list)
    {
            try {
                    if(null != packageManager.getLaunchIntentForPackage(info.packageName))
                    {       
                            applist.add(info);
                    }
            } catch (Exception e) {
                    e.printStackTrace();
            }
    }
    
            return applist;
}

private class LoadApplicationTask extends AsyncTask&lt;Void, Void, Void&gt;
{
    private ProgressDialog progress = null;
    
            @Override
            protected Void doInBackground(Void... params) {
                    applist = checkForLaunchIntent(
                            packageManager.getInstalledApplications(PackageManager.GET_META_DATA));
                    
            listadaptor = new ApplicationAdaptor(ExternalAppLauncherActivity.this, R.layout.appview, applist);
            
                    return null;
            }

            @Override
            protected void onCancelled() {
                    super.onCancelled();
            }

            @Override
            protected void onPostExecute(Void result) {
                    setListAdapter(listadaptor);
                    
                    progress.dismiss();
                    
                    super.onPostExecute(result);
            }

            @Override
            protected void onPreExecute() {
                    progress = ProgressDialog.show(
                    		ExternalAppLauncherActivity.this, null, &quot;Loading application info...&quot;);
                    
                    super.onPreExecute();
            }

            @Override
            protected void onProgressUpdate(Void... values) {
                    super.onProgressUpdate(values);
            }
}

    private class ApplicationAdaptor extends ArrayAdapter&lt;ApplicationInfo&gt;
{
    private List&lt;ApplicationInfo&gt; objects = null;

            public ApplicationAdaptor(Context context, 
                            int textViewResourceId,
                            List&lt;ApplicationInfo&gt; objects) 
            {
                    super(context, textViewResourceId, objects);
                    
                    this.objects = objects;
            }
    
            @Override
            public int getCount() {
                    return ((null != objects) ? objects.size() : 0);
            }

            @Override
            public ApplicationInfo getItem(int position) {
                    return ((null != objects) ? objects.get(position) : null);
            }

            @Override
            public long getItemId(int position) {
                    return position;
            }
            
            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                    View view = convertView;
                    
                    if(null == view)
                    {
                            LayoutInflater vi = (LayoutInflater)ExternalAppLauncherActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                            view = vi.inflate(R.layout.appview, null);
                    }
                    
                    ApplicationInfo data = objects.get(position);
                    
                    if(null != data)
                    {
                            TextView textName = (TextView)view.findViewById(R.id.app_name);
                            ImageView iconview = (ImageView)view.findViewById(R.id.app_icon);
                            
                            textName.setText(data.loadLabel(packageManager) + &quot; (&quot; + data.packageName + &quot;)&quot;);
                            iconview.setImageDrawable(data.loadIcon(packageManager));
                    }
                    
                    return view;
            }
};
}
</pre>
<p>3.) Compile and build the project.</p>
<p>Note: &#8211; For better results check on device. </p>
<p>Output</p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/11/externalapplauncher1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/11/externalapplauncher1.png" alt="" title="externalapplauncher1" width="413" height="351" class="alignnone size-full wp-image-2155" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/11/externalapplauncher2.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/11/externalapplauncher2.png" alt="" title="externalapplauncher2" width="412" height="353" class="alignnone size-full wp-image-2156" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-game-programming/external-app-launcher-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIByProgramExample in Android Development</title>
		<link>http://www.edumobile.org/android/android-beginner-tutorials/uibyprogramexample-in-android-development/</link>
		<comments>http://www.edumobile.org/android/android-beginner-tutorials/uibyprogramexample-in-android-development/#comments</comments>
		<pubDate>Tue, 30 Apr 2013 11:35:41 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Android Beginner Tutorials]]></category>
		<category><![CDATA[Android Game Programming]]></category>
		<category><![CDATA[UIByProgram Example tutorials]]></category>
		<category><![CDATA[UIByProgramExample]]></category>
		<category><![CDATA[UIByProgramExample Android]]></category>
		<category><![CDATA[UIByProgramExample in Android Development]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=2427</guid>
		<description><![CDATA[This example will show you how to design UI through code. Algorithm: 1.) Create a new project by File-> New -> Android Project name it UIByProgramExample. 2.) Write following into main.xml: 3.) Run for output. Steps: 1.) Create a project named UIByProgramExample and set the information as stated in the image. Build Target: Android 4.2 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2013/04/thumb2.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2013/04/thumb2-150x150.jpg" alt="" title="thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-2428" /></a>This example will show you how to design UI through code.</p>
<p>Algorithm:</p>
<p>1.)	Create a new project by File-> New -> Android Project name it UIByProgramExample.</p>
<p>2.)	Write following into main.xml:<br />
<br/></p>
<pre class="brush: java; 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;/LinearLayout&gt;

</pre>
<p>3.)	Run for output.</p>
<p>Steps:</p>
<p>1.) Create a project named UIByProgramExample and set the information as stated in the image.</p>
<p>	Build Target: Android 4.2<br />
	Application Name: UIByProgramExample<br />
	Package Name: com. UIByProgramExample<br />
	Activity Name: UIByProgramExample<br />
	Min SDK Version: 4.2</p>
<p>2.) Open UIByProgramExample.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.uibyprogramexample;

import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;

public class UIByProgramExample extends Activity {
	
	LinearLayout lLayout;
	TextView tView;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        lLayout = new LinearLayout(this);
        lLayout.setOrientation(LinearLayout.VERTICAL);
        lLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        tView = new TextView(this);
        tView.setText(&quot;Hello, This is a view created programmatically! &quot; +
        		&quot;You CANNOT change it easily <img src='http://www.edumobile.org/android/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> &quot;);
        tView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
        lLayout.addView(tView);
        setContentView(lLayout);
    }
}
</pre>
<p>3.)	Compile and build the project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-beginner-tutorials/uibyprogramexample-in-android-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drawable Animation Example in Android programming</title>
		<link>http://www.edumobile.org/android/android-development/drawable-animation-example-in-android-programming/</link>
		<comments>http://www.edumobile.org/android/android-development/drawable-animation-example-in-android-programming/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 10:32:22 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Android Development]]></category>
		<category><![CDATA[ANDROID SDK TUTORIAL]]></category>
		<category><![CDATA[Android Drawable Animation Example]]></category>
		<category><![CDATA[Android Drawable Animation tutorial]]></category>
		<category><![CDATA[android free codes]]></category>
		<category><![CDATA[android free tutorials]]></category>
		<category><![CDATA[Drawable Animation Example]]></category>
		<category><![CDATA[Drawable Animation Example in Android programming]]></category>
		<category><![CDATA[Drawable Animation Example source code]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=1890</guid>
		<description><![CDATA[This example explains how you can animate your drawbles. Algorithm: 1.) Create a new project by File-> New -> Android Project name it DrawableAnimationExample. 2.) Create and write following into GraphicsActivity.java: 3.) Write following into PictureLayout.java: 4.) Write following into AnimateDrawable.java: 5.) Write following into ProxyDrawable.java: 6.) Run for output. Steps: 1.) Create a project [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/thumb3.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/thumb3-150x150.jpg" alt="" title="thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-1893" /></a>This example explains how you can animate your drawbles.</p>
<p><strong>Algorithm:</strong></p>
<p>1.)	Create a new project by File-> New -> Android Project name it DrawableAnimationExample.</p>
<p>2.)	Create and write following into GraphicsActivity.java:<br />
</br></p>
<pre class="brush: java; title: ; notranslate">

package com.example.DrawableAnimationExample;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;

class GraphicsActivity extends Activity {
   
    private static final boolean TEST_PICTURE = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void setContentView(View view) {
        if (TEST_PICTURE) {
            ViewGroup vg = new PictureLayout(this);
            vg.addView(view);
            view = vg;
        }

        super.setContentView(view);
    }
}
</pre>
<p>3.)	Write following into PictureLayout.java:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.DrawableAnimationExample;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Picture;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;

public class PictureLayout extends ViewGroup {
    private final Picture mPicture = new Picture();

    public PictureLayout(Context context) {
        super(context);
    }

    public PictureLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void addView(View child) {
        if (getChildCount() &gt; 1) {
            throw new IllegalStateException(&quot;PictureLayout can host only one direct child&quot;);
        }

        super.addView(child);
    }

    @Override
    public void addView(View child, int index) {
        if (getChildCount() &gt; 1) {
            throw new IllegalStateException(&quot;PictureLayout can host only one direct child&quot;);
        }

        super.addView(child, index);
    }

    @Override
    public void addView(View child, LayoutParams params) {
        if (getChildCount() &gt; 1) {
            throw new IllegalStateException(&quot;PictureLayout can host only one direct child&quot;);
        }

        super.addView(child, params);
    }

    @Override
    public void addView(View child, int index, LayoutParams params) {
        if (getChildCount() &gt; 1) {
            throw new IllegalStateException(&quot;PictureLayout can host only one direct child&quot;);
        }

        super.addView(child, index, params);
    }

    @Override
    protected LayoutParams generateDefaultLayoutParams() {
        return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        final int count = getChildCount();

        int maxHeight = 0;
        int maxWidth = 0;

        for (int i = 0; i &lt; count; i++) {
            final View child = getChildAt(i);
            if (child.getVisibility() != GONE) {
                measureChild(child, widthMeasureSpec, heightMeasureSpec);
            }
        }

        maxWidth += getPaddingLeft() + getPaddingRight();
        maxHeight += getPaddingTop() + getPaddingBottom();

        Drawable drawable = getBackground();
        if (drawable != null) {
            maxHeight = Math.max(maxHeight, drawable.getMinimumHeight());
            maxWidth = Math.max(maxWidth, drawable.getMinimumWidth());
        }

        setMeasuredDimension(resolveSize(maxWidth, widthMeasureSpec),
                resolveSize(maxHeight, heightMeasureSpec));
    }

    private void drawPict(Canvas canvas, int x, int y, int w, int h,
                          float sx, float sy) {
        canvas.save();
        canvas.translate(x, y);
        canvas.clipRect(0, 0, w, h);
        canvas.scale(0.5f, 0.5f);
        canvas.scale(sx, sy, w, h);
        canvas.drawPicture(mPicture);
        canvas.restore();
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(mPicture.beginRecording(getWidth(), getHeight()));
        mPicture.endRecording();

        int x = getWidth()/2;
        int y = getHeight()/2;

        if (false) {
            canvas.drawPicture(mPicture);
        } else {
            drawPict(canvas, 0, 0, x, y,  1,  1);
            drawPict(canvas, x, 0, x, y, -1,  1);
            drawPict(canvas, 0, y, x, y,  1, -1);
            drawPict(canvas, x, y, x, y, -1, -1);
        }
    }

    @Override
    public ViewParent invalidateChildInParent(int[] location, Rect dirty) {
        location[0] = getLeft();
        location[1] = getTop();
        dirty.set(0, 0, getWidth(), getHeight());
        return getParent();
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        final int count = super.getChildCount();

        for (int i = 0; i &lt; count; i++) {
            final View child = getChildAt(i);
            if (child.getVisibility() != GONE) {
                final int childLeft = getPaddingLeft();
                final int childTop = getPaddingTop();
                child.layout(childLeft, childTop,
                        childLeft + child.getMeasuredWidth(),
                        childTop + child.getMeasuredHeight());

            }
        }
    }
}
</pre>
<p>4.)	Write following into AnimateDrawable.java:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.DrawableAnimationExample;

import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Transformation;

public class AnimateDrawable extends ProxyDrawable {

    private Animation mAnimation;
    private Transformation mTransformation = new Transformation();

    public AnimateDrawable(Drawable target) {
        super(target);
    }

    public AnimateDrawable(Drawable target, Animation animation) {
        super(target);
        mAnimation = animation;
    }

    public Animation getAnimation() {
        return mAnimation;
    }

    public void setAnimation(Animation anim) {
        mAnimation = anim;
    }

    public boolean hasStarted() {
        return mAnimation != null &amp;&amp; mAnimation.hasStarted();
    }

    public boolean hasEnded() {
        return mAnimation == null || mAnimation.hasEnded();
    }

    @Override
    public void draw(Canvas canvas) {
        Drawable dr = getProxy();
        if (dr != null) {
            int sc = canvas.save();
            Animation anim = mAnimation;
            if (anim != null) {
                anim.getTransformation(
                                    AnimationUtils.currentAnimationTimeMillis(),
                                    mTransformation);
                canvas.concat(mTransformation.getMatrix());
            }
            dr.draw(canvas);
            canvas.restoreToCount(sc);
        }
    }
}
</pre>
<p>5.)	Write following into ProxyDrawable.java:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.DrawableAnimationExample;

import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;

public class ProxyDrawable extends Drawable {

    private Drawable mProxy;
    private boolean mMutated;

    public ProxyDrawable(Drawable target) {
        mProxy = target;
    }

    public Drawable getProxy() {
        return mProxy;
    }

    public void setProxy(Drawable proxy) {
        if (proxy != this) {
            mProxy = proxy;
        }
    }

    @Override
    public void draw(Canvas canvas) {
        if (mProxy != null) {
            mProxy.draw(canvas);
        }
    }

    @Override
    public int getIntrinsicWidth() {
        return mProxy != null ? mProxy.getIntrinsicWidth() : -1;
    }

    @Override
    public int getIntrinsicHeight() {
        return mProxy != null ? mProxy.getIntrinsicHeight() : -1;
    }

    @Override
    public int getOpacity() {
        return mProxy != null ? mProxy.getOpacity() : PixelFormat.TRANSPARENT;
    }

    @Override
    public void setFilterBitmap(boolean filter) {
        if (mProxy != null) {
            mProxy.setFilterBitmap(filter);
        }
    }

    @Override
    public void setDither(boolean dither) {
        if (mProxy != null) {
            mProxy.setDither(dither);
        }
    }

    @Override
    public void setColorFilter(ColorFilter colorFilter) {
        if (mProxy != null) {
            mProxy.setColorFilter(colorFilter);
        }
    }

    @Override
    public void setAlpha(int alpha) {
        if (mProxy != null) {
            mProxy.setAlpha(alpha);
        }
    }

    @Override
    public Drawable mutate() {
        if (mProxy != null &amp;&amp; !mMutated &amp;&amp; super.mutate() == this) {
            mProxy.mutate();
            mMutated = true;
        }
        return this;
    }
}
</pre>
<p>6.)	Run for output.</p>
<p>Steps:</p>
<p>1.) Create a project named DrawableAnimationExample and set the information as stated in the image.</p>
<p>	Build Target: Android 4.0<br />
	Application Name: DrawableAnimationExample<br />
	Package Name: com. example. DrawableAnimationExample<br />
	Activity Name: DrawableAnimationExample<br />
	Min SDK Version: 14</p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/drawableanimationexample1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/drawableanimationexample1-1024x546.png" alt="" title="drawableanimationexample1" width="524" height="276" class="alignleft size-large wp-image-1891" /></a></p>
<p>2.) Open DrawableAnimationExample.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.DrawableAnimationExample;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

public class DrawableAnimationExample extends GraphicsActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new SampleView(this));
    }

    private static class SampleView extends View {
        private AnimateDrawable mDrawable;

        public SampleView(Context context) {
            super(context);
            setFocusable(true);
            setFocusableInTouchMode(true);

            Drawable dr = context.getResources().getDrawable(R.drawable.android);
            dr.setBounds(0, 0, dr.getIntrinsicWidth(), dr.getIntrinsicHeight());

            Animation an = new TranslateAnimation(0, 100, 0, 200);
            an.setDuration(2000);
            an.setRepeatCount(-1);
            an.initialize(10, 10, 10, 10);

            mDrawable = new AnimateDrawable(dr, an);
            an.startNow();
        }

        @Override
        protected void onDraw(Canvas canvas) {
            canvas.drawColor(Color.WHITE);

            mDrawable.draw(canvas);
            invalidate();
        }
    }
}
</pre>
<p>3.) Compile and build the project.</p>
<p><strong>Output</strong></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/07/drawableanimationexample2.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/07/drawableanimationexample2.png" alt="" title="drawableanimationexample2" width="513" height="429" class="alignnone size-full wp-image-1892" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-development/drawable-animation-example-in-android-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Share Your Data Android Programming</title>
		<link>http://www.edumobile.org/android/android-programming-tutorials/share-your-data-android-programming/</link>
		<comments>http://www.edumobile.org/android/android-programming-tutorials/share-your-data-android-programming/#comments</comments>
		<pubDate>Tue, 23 Apr 2013 12:38:28 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Android Programming Tutorials]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[android apis]]></category>
		<category><![CDATA[android development]]></category>
		<category><![CDATA[android sdk]]></category>
		<category><![CDATA[android source codes]]></category>
		<category><![CDATA[free Share Your Data Android]]></category>
		<category><![CDATA[Share Your Data]]></category>
		<category><![CDATA[Share Your Data Android]]></category>
		<category><![CDATA[Share Your Data Android programming]]></category>
		<category><![CDATA[Share Your Data Android tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=2060</guid>
		<description><![CDATA[This example shows how you can share your text and data with your friends. Algorithm: 1.) Create a new project by File-> New -> Android Project name it ShareYourData. 2.) Write following into activity_main.xml: 3.) Write following into res/values/styles.xml: 4.) Run for output. Steps: 1.) Create a project named ShareYourData and set the information as [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/10/thumb1.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/10/thumb1-150x138.jpg" alt="" title="thumb" width="150" height="138" class="alignleft size-thumbnail wp-image-2066" /></a>This example shows how you can share your text and data with your friends.</p>
<p>Algorithm:</p>
<p>1.)	Create a new project by File-> New -> Android Project name it ShareYourData.</p>
<p>2.)	Write following into activity_main.xml:</p>
<pre class="brush: java; 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:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    android:background=&quot;#C0C0C0&quot;
    android:orientation=&quot;vertical&quot; &gt;
    &lt;Button
        android:id=&quot;@+id/button2&quot;
        android:layout_width=&quot;wrap_content&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:text=&quot;Share Data&quot; 
        android:onClick=&quot;shareData&quot;
        /&gt;
&lt;/LinearLayout&gt;
</pre>
<p>3.)	Write following into res/values/styles.xml:</p>
<pre class="brush: java; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;resources&gt;
	&lt;style name=&quot;myText&quot;&gt;
		&lt;item name=&quot;android:textColor&quot;&gt;#000000&lt;/item&gt;
		&lt;item name=&quot;android:textSize&quot;&gt;22sp&lt;/item&gt;
		&lt;item name=&quot;android:padding&quot;&gt;3dip&lt;/item&gt;
	&lt;/style&gt;
&lt;/resources&gt;
</pre>
<p>4.)	Run for output.</p>
<p>Steps:</p>
<p>1.) Create a project named ShareYourData and set the information as stated in the image.</p>
<p>	Build Target: Android 4.0<br />
	Application Name: ShareYourData<br />
	Package Name: com. example. ShareYourData<br />
	Activity Name: MainActivity<br />
	Min SDK Version: 11</p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata1-1024x616.png" alt="" title="shareyourdata1" width="524" height="316" class="alignnone size-large wp-image-2061" /></a></p>
<p>2.) Open MainActivity.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.shareyourdata;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		}
	public void shareData(View view) {
		Intent intent = new Intent(Intent.ACTION_SEND);
		intent.setType(&quot;text/plain&quot;);
		intent.putExtra(Intent.EXTRA_TEXT, &quot;This is my shared text&quot;);
		startActivity(Intent.createChooser(intent, &quot;Share this text via&quot;));
	}
}
</pre>
<p>3.) Compile and build the project.</p>
<p>Output</p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata2.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata2-300x277.png" alt="" title="shareyourdata2" width="300" height="277" class="alignnone size-medium wp-image-2062" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata3.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata3-300x277.png" alt="" title="shareyourdata3" width="300" height="277" class="alignnone size-medium wp-image-2063" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata4.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata4-300x277.png" alt="" title="shareyourdata4" width="300" height="277" class="alignnone size-medium wp-image-2064" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata5.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/10/shareyourdata5-300x277.png" alt="" title="shareyourdata5" width="300" height="277" class="alignnone size-medium wp-image-2065" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-programming-tutorials/share-your-data-android-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random Layout Animation</title>
		<link>http://www.edumobile.org/android/android-beginner-tutorials/random-layout-animation/</link>
		<comments>http://www.edumobile.org/android/android-beginner-tutorials/random-layout-animation/#comments</comments>
		<pubDate>Fri, 19 Apr 2013 06:10:20 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Android Beginner Tutorials]]></category>
		<category><![CDATA[Random Layout Animation]]></category>
		<category><![CDATA[Random Layout Animation Android]]></category>
		<category><![CDATA[Random Layout Animation Android programming]]></category>
		<category><![CDATA[Random Layout Animation android tutorials]]></category>
		<category><![CDATA[Random Layout Animation codes and examples]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=1569</guid>
		<description><![CDATA[This example shows how you can animate contents of a layout and show them randomly. Algorithm: 1.) Create a new project by File-> New -> Android Project name it RandomLayoutAnimation. 2.) Create an anim folder into res directory and create and write following into res/anim/fade.xml: 3.) Create and write following into res/anim/ layout_random_fade.xml: 4.) Write [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/02/thumb2.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/02/thumb2-150x150.jpg" alt="" title="thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-1574" /></a>This example shows how you can animate contents of a layout and show them randomly.</p>
<p>Algorithm:</p>
<p>1.)	Create a new project by File-> New -> Android Project name it RandomLayoutAnimation.</p>
<p>2.)	Create an anim folder into res directory and create and write following into res/anim/fade.xml:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;alpha xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
       android:interpolator=&quot;@android:anim/accelerate_interpolator&quot;
       android:fromAlpha=&quot;0.0&quot; android:toAlpha=&quot;1.0&quot;
       android:duration=&quot;@android:integer/config_longAnimTime&quot; /&gt;
</pre>
<p>3.)	Create and write following into res/anim/ layout_random_fade.xml:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;layoutAnimation xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
        android:delay=&quot;0.5&quot;
        android:animationOrder=&quot;random&quot;
        android:animation=&quot;@anim/fade&quot; /&gt;
</pre>
<p>4.)	Write following into your main.xml:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;GridView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; android:id=&quot;@+id/grid&quot;
    android:layoutAnimation=&quot;@anim/layout_random_fade&quot;

    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    android:padding=&quot;10dp&quot;
    android:verticalSpacing=&quot;10dp&quot;

    android:horizontalSpacing=&quot;10dp&quot;
    android:numColumns=&quot;auto_fit&quot;
    android:columnWidth=&quot;60dp&quot;
    android:stretchMode=&quot;columnWidth&quot;

    android:gravity=&quot;center&quot; /&gt;
</pre>
<p>5.)	Run for output.</p>
<p>Steps:<br />
1.) Create a project named RandomLayoutAnimation and set the information as stated in the image.</p>
<p>	Build Target: Android 2.3.3<br />
	Application Name: RandomLayoutAnimation<br />
	Package Name: com.example. RandomLayoutAnimation<br />
	Activity Name: RandomLayoutAnimation<br />
	Min SDK Version: 10</p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout1-300x213.png" alt="" title="randomlayout1" width="300" height="213" class="alignnone size-medium wp-image-1570" /></a></p>
<p>2.) Open RandomLayoutAnimation.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.RandomLayoutAnimation;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class RandomLayoutAnimation extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        loadApps();

        setContentView(R.layout.main);
        GridView grid = (GridView) findViewById(R.id.grid);
        grid.setAdapter(new AppsAdapter());

    }

    private List&lt;ResolveInfo&gt; mApps;

    private void loadApps() {
        Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
        mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);

        mApps = getPackageManager().queryIntentActivities(mainIntent, 0);
    }

    public class AppsAdapter extends BaseAdapter {
        public View getView(int position, View convertView, ViewGroup parent) {
            ImageView i = new ImageView(RandomLayoutAnimation.this);

            ResolveInfo info = mApps.get(position % mApps.size());

            i.setImageDrawable(info.activityInfo.loadIcon(getPackageManager()));
            i.setScaleType(ImageView.ScaleType.FIT_CENTER);
            final int w = (int) (36 * getResources().getDisplayMetrics().density + 0.5f);
            i.setLayoutParams(new GridView.LayoutParams(w, w));
            return i;
        }


        public final int getCount() {
            return Math.min(32, mApps.size());
        }

        public final Object getItem(int position) {
            return mApps.get(position % mApps.size());
        }

        public final long getItemId(int position) {
            return position;
        }
    }
}
</pre>
<p>3.) Compile and build the project.</p>
<p>Output<br />
<a href="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout1-300x213.png" alt="" title="randomlayout1" width="300" height="213" class="alignnone size-medium wp-image-1570" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout2.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout2-300x275.png" alt="" title="randomlayout2" width="300" height="275" class="alignnone size-medium wp-image-1571" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout3.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout3-300x275.png" alt="" title="randomlayout3" width="300" height="275" class="alignnone size-medium wp-image-1572" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout4.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/02/randomlayout4-300x275.png" alt="" title="randomlayout4" width="300" height="275" class="alignnone size-medium wp-image-1573" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-beginner-tutorials/random-layout-animation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>InflateUIView in Android</title>
		<link>http://www.edumobile.org/android/android-tutorial/inflateuiview-in-android/</link>
		<comments>http://www.edumobile.org/android/android-tutorial/inflateuiview-in-android/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 10:44:36 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[ANDROID TUTORIAL]]></category>
		<category><![CDATA[InflateUIView Android]]></category>
		<category><![CDATA[InflateUIView Android tutorials]]></category>
		<category><![CDATA[InflateUIView example]]></category>
		<category><![CDATA[InflateUIView tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=2386</guid>
		<description><![CDATA[This example will show to use inflate view in android. Algorithm: 1.) Create a new project by File-> New -> Android Project name it InflateUIView. 2.) Write following into main.xml: 3.) Create and write following into layout/buttons.xml: 4.) Create and write following into layout/text.xml: 5.) Run for output. Steps: 1.) Create a project named InflateUIView [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2013/04/thumb1.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2013/04/thumb1-150x150.jpg" alt="" title="thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-2389" /></a>This example will show to use inflate view in android.</p>
<p>Algorithm:</p>
<p>1.)	Create a new project by File-> New -> Android Project name it InflateUIView.</p>
<p>2.)	Write following into main.xml:<br />
</br><br />
</br></p>
<pre class="brush: java; 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;
    android:id=&quot;@+id/layout1&quot;
    &gt;
&lt;/LinearLayout&gt;
</pre>
<p>3.)	Create and write following into layout/buttons.xml:</p>
<pre class="brush: java; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;

&lt;Button xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
        android:id=&quot;@+id/button_small_left&quot;
 style=&quot;?android:attr/buttonStyleSmall&quot;
        android:text=&quot;Press to close&quot;
    android:layout_width=&quot;wrap_content&quot;
    android:layout_height=&quot;wrap_content&quot;/&gt;
</pre>
<p>4.)	Create and write following into layout/text.xml:</p>
<pre class="brush: java; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;

	&lt;TextView  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
	    android:layout_width=&quot;fill_parent&quot; 
	    android:layout_height=&quot;wrap_content&quot; 
	    android:text=&quot;@string/dynamic_text&quot;
	 &gt;&lt;/TextView&gt;
</pre>
<p>5.)	Run for output.</p>
<p>Steps:</p>
<p>1.) Create a project named InflateUIView and set the information as stated in the image.</p>
<p>	Build Target: Android 4.2<br />
	Application Name: InflateUIView<br />
	Package Name: com. example. InflateUIView<br />
	Activity Name: InflateUIView<br />
	Min SDK Version: 4.2</p>
<p>2.) Open InflateUIView.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.inflateview;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class InflateView extends Activity {
	
	LinearLayout lLayout;
	float[] orientation;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final LayoutInflater  inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        Button b = (Button)inflater.inflate(R.layout.buttons,
                null);
        
        lLayout = (LinearLayout)findViewById(R.id.layout1);
        lLayout.addView(b);
        
        b.setOnClickListener(new OnClickListener() {
        	
        	public void onClick(View v) {
        		//restrict to adding only 1 textview child element
        		if (lLayout.getChildAt(2) == null)
        		{
        		TextView tv = (TextView)inflater.inflate(R.layout.text, null);
        		lLayout.addView(tv);
        		}
        	}
        });
    }
}
</pre>
<p>3.) Compile and build the project.</p>
<p>  Output</p>
<p>  <a href="http://www.edumobile.org/android/wp-content/uploads/2013/04/inflateview1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2013/04/inflateview1-257x300.png" alt="" title="inflateview1" width="257" height="300" class="alignnone size-medium wp-image-2387" /></a></p>
<p>  <a href="http://www.edumobile.org/android/wp-content/uploads/2013/04/inflateview2.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2013/04/inflateview2-257x300.png" alt="" title="inflateview2" width="257" height="300" class="alignnone size-medium wp-image-2388" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-tutorial/inflateuiview-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handler Thread Activity in Android Programming</title>
		<link>http://www.edumobile.org/android/android-programming-tutorials/handler-thread-activity-in-android-programming/</link>
		<comments>http://www.edumobile.org/android/android-programming-tutorials/handler-thread-activity-in-android-programming/#comments</comments>
		<pubDate>Sat, 13 Apr 2013 11:42:48 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Android Programming Tutorials]]></category>
		<category><![CDATA[Handler Thread Activity Android]]></category>
		<category><![CDATA[Handler Thread Activity example]]></category>
		<category><![CDATA[Handler Thread Activity in Android]]></category>
		<category><![CDATA[Handler Thread Activity in Android tutorials]]></category>
		<category><![CDATA[Handler Thread Activity tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=2378</guid>
		<description><![CDATA[This example will show you how to handle parent and child thread and switch between activities. Algorithm: 1.) Create a new project by File-> New -> Android Project name it HandlerThreadActivity. 2.) Write following into main.xml: 3.) Run for output. Steps: 1.) Create a project named HandlerThreadActivity and set the information as stated in the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2013/04/thumb.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2013/04/thumb-150x150.jpg" alt="" title="thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-2382" /></a>This example will show you how to handle parent and child thread and switch between activities.</p>
<p>Algorithm:</p>
<p>1.)	Create a new project by File-> New -> Android Project name it HandlerThreadActivity.</p>
<p>2.)	Write following into main.xml:</p>
<pre class="brush: java; 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;Button 
	android:id=&quot;@+id/Button01&quot; 
	android:layout_width=&quot;wrap_content&quot; 
	android:layout_height=&quot;wrap_content&quot; 
	android:text=&quot;@string/start_thread&quot;&gt;&lt;/Button&gt;
&lt;/LinearLayout&gt;
</pre>
<p>3.)	Run for output.</p>
<p>Steps:</p>
<p>1.) Create a project named HandlerThreadActivity and set the information as stated in the image.</p>
<p>	Build Target: Android 4.2<br />
	Application Name: HandlerThreadActivity<br />
	Package Name: com. HandlerThreadActivity<br />
	Activity Name: HandlerThreadActivity<br />
	Min SDK Version: 4.2</p>
<p>2.) Open HandlerThreadActivity.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.handlerthreadactivity;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class HandlerThreadActivity extends Activity{
   
	private Button start;
	private ProgressDialog progressDialog;
	
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        start = (Button) findViewById(R.id.Button01);
        start.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				fetchData();
			}
        	
        });
    }

	protected void fetchData() {
		// TODO Auto-generated method stub
		progressDialog = ProgressDialog.show(this, &quot;&quot;, &quot;Loading...&quot;);
		new Thread() {
			public void run() {
				try {

					Thread.sleep(800);

					} catch (InterruptedException e) {

					}
					messageHandler.sendEmptyMessage(0);

			}
		}.start();
	}



	private Handler messageHandler = new Handler() {
		
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
			progressDialog.dismiss();
		}
	};
}
</pre>
<p>4.)	Compile and build the project.</p>
<p>  Output<br />
<a href="http://www.edumobile.org/android/wp-content/uploads/2013/04/handlerthreadactivity1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2013/04/handlerthreadactivity1.png" alt="" title="handlerthreadactivity1" width="350" height="410" class="alignnone size-full wp-image-2380" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2013/04/handlerthreadactivity2.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2013/04/handlerthreadactivity2.png" alt="" title="handlerthreadactivity2" width="350" height="410" class="alignnone size-full wp-image-2381" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-programming-tutorials/handler-thread-activity-in-android-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Splitting Touch Example in Android</title>
		<link>http://www.edumobile.org/android/android-development/splitting-touch-example-in-android/</link>
		<comments>http://www.edumobile.org/android/android-development/splitting-touch-example-in-android/#comments</comments>
		<pubDate>Tue, 09 Apr 2013 11:19:48 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Android Development]]></category>
		<category><![CDATA[ANDROID SDK TUTORIAL]]></category>
		<category><![CDATA[android programming]]></category>
		<category><![CDATA[Android Splitting Touch Example]]></category>
		<category><![CDATA[Splitting Touch Example]]></category>
		<category><![CDATA[Splitting Touch Example in Android]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/android/?p=1758</guid>
		<description><![CDATA[This example shows how you can create and handle multiple touch events on different lists. Algorithm: 1.) Create a new project by File-> New -> Android Project name it SplittingTouchExample. 2.) Create and write following into src\Cheeses.java: 3.) Write following into main.xml: 4.) Create and write following into values\arrays.xml: 5.) Write following into strings.xml: 6.) [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/06/thumb4.jpg"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/06/thumb4-150x150.jpg" alt="" title="thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-1765" /></a>This example shows how you can create and handle multiple touch events on different lists.</p>
<p><strong>Algorithm:</strong></p>
<p>1.)	Create a new project by File-> New -> Android Project name it SplittingTouchExample.</p>
<p>2.)	Create and write following into src\Cheeses.java:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.SplittingTouchExample;


public class Cheeses {

    public static final String[] sCheeseStrings = {
            &quot;Abbaye de Belloc&quot;, &quot;Abbaye du Mont des Cats&quot;, &quot;Abertam&quot;, &quot;Abondance&quot;, &quot;Ackawi&quot;,
            &quot;Acorn&quot;, &quot;Adelost&quot;, &quot;Affidelice au Chablis&quot;, &quot;Afuega'l Pitu&quot;, &quot;Airag&quot;, &quot;Airedale&quot;,
            &quot;Aisy Cendre&quot;, &quot;Allgauer Emmentaler&quot;, &quot;Alverca&quot;, &quot;Ambert&quot;, &quot;American Cheese&quot;,
            &quot;Ami du Chambertin&quot;, &quot;Anejo Enchilado&quot;, &quot;Anneau du Vic-Bilh&quot;, &quot;Anthoriro&quot;, &quot;Appenzell&quot;,
            &quot;Aragon&quot;, &quot;Ardi Gasna&quot;, &quot;Ardrahan&quot;, &quot;Armenian String&quot;, &quot;Aromes au Gene de Marc&quot;,
            &quot;Asadero&quot;, &quot;Asiago&quot;, &quot;Aubisque Pyrenees&quot;, &quot;Autun&quot;, &quot;Avaxtskyr&quot;, &quot;Baby Swiss&quot;,
            &quot;Babybel&quot;, &quot;Baguette Laonnaise&quot;, &quot;Bakers&quot;, &quot;Baladi&quot;, &quot;Balaton&quot;, &quot;Bandal&quot;, &quot;Banon&quot;,
            &quot;Barry's Bay Cheddar&quot;, &quot;Basing&quot;, &quot;Basket Cheese&quot;, &quot;Bath Cheese&quot;, &quot;Bavarian Bergkase&quot;,
            &quot;Baylough&quot;, &quot;Beaufort&quot;, &quot;Beauvoorde&quot;, &quot;Beenleigh Blue&quot;, &quot;Beer Cheese&quot;, &quot;Bel Paese&quot;,
            &quot;Bergader&quot;, &quot;Bergere Bleue&quot;, &quot;Berkswell&quot;, &quot;Beyaz Peynir&quot;, &quot;Bierkase&quot;, &quot;Bishop Kennedy&quot;,
            &quot;Blarney&quot;, &quot;Bleu d'Auvergne&quot;, &quot;Bleu de Gex&quot;, &quot;Bleu de Laqueuille&quot;,
            &quot;Bleu de Septmoncel&quot;, &quot;Bleu Des Causses&quot;, &quot;Blue&quot;, &quot;Blue Castello&quot;, &quot;Blue Rathgore&quot;,
            &quot;Blue Vein (Australian)&quot;, &quot;Blue Vein Cheeses&quot;, &quot;Bocconcini&quot;, &quot;Bocconcini (Australian)&quot;,
            &quot;Boeren Leidenkaas&quot;, &quot;Bonchester&quot;, &quot;Bosworth&quot;, &quot;Bougon&quot;, &quot;Boule Du Roves&quot;,
            &quot;Boulette d'Avesnes&quot;, &quot;Boursault&quot;, &quot;Boursin&quot;, &quot;Bouyssou&quot;, &quot;Bra&quot;, &quot;Braudostur&quot;,
            &quot;Breakfast Cheese&quot;, &quot;Brebis du Lavort&quot;, &quot;Brebis du Lochois&quot;, &quot;Brebis du Puyfaucon&quot;,
            &quot;Bresse Bleu&quot;, &quot;Brick&quot;, &quot;Brie&quot;, &quot;Brie de Meaux&quot;, &quot;Brie de Melun&quot;, &quot;Brillat-Savarin&quot;,
            &quot;Brin&quot;, &quot;Brin d' Amour&quot;, &quot;Brin d'Amour&quot;, &quot;Brinza (Burduf Brinza)&quot;,
            &quot;Briquette de Brebis&quot;, &quot;Briquette du Forez&quot;, &quot;Broccio&quot;, &quot;Broccio Demi-Affine&quot;,
            &quot;Brousse du Rove&quot;, &quot;Bruder Basil&quot;, &quot;Brusselae Kaas (Fromage de Bruxelles)&quot;, &quot;Bryndza&quot;,
            &quot;Buchette d'Anjou&quot;, &quot;Buffalo&quot;, &quot;Burgos&quot;, &quot;Butte&quot;, &quot;Butterkase&quot;, &quot;Button (Innes)&quot;,
            &quot;Buxton Blue&quot;, &quot;Cabecou&quot;, &quot;Caboc&quot;, &quot;Cabrales&quot;, &quot;Cachaille&quot;, &quot;Caciocavallo&quot;, &quot;Caciotta&quot;,
            &quot;Caerphilly&quot;, &quot;Cairnsmore&quot;, &quot;Calenzana&quot;, &quot;Cambazola&quot;, &quot;Camembert de Normandie&quot;,
            &quot;Canadian Cheddar&quot;, &quot;Canestrato&quot;, &quot;Cantal&quot;, &quot;Caprice des Dieux&quot;, &quot;Capricorn Goat&quot;,
            &quot;Capriole Banon&quot;, &quot;Carre de l'Est&quot;, &quot;Casciotta di Urbino&quot;, &quot;Cashel Blue&quot;, &quot;Castellano&quot;,
            &quot;Castelleno&quot;, &quot;Castelmagno&quot;, &quot;Castelo Branco&quot;, &quot;Castigliano&quot;, &quot;Cathelain&quot;,
            &quot;Celtic Promise&quot;, &quot;Cendre d'Olivet&quot;, &quot;Cerney&quot;, &quot;Chabichou&quot;, &quot;Chabichou du Poitou&quot;,
            &quot;Chabis de Gatine&quot;, &quot;Chaource&quot;, &quot;Charolais&quot;, &quot;Chaumes&quot;, &quot;Cheddar&quot;,
            &quot;Cheddar Clothbound&quot;, &quot;Cheshire&quot;, &quot;Chevres&quot;, &quot;Chevrotin des Aravis&quot;, &quot;Chontaleno&quot;,
            &quot;Civray&quot;, &quot;Coeur de Camembert au Calvados&quot;, &quot;Coeur de Chevre&quot;, &quot;Colby&quot;, &quot;Cold Pack&quot;,
            &quot;Comte&quot;, &quot;Coolea&quot;, &quot;Cooleney&quot;, &quot;Coquetdale&quot;, &quot;Corleggy&quot;, &quot;Cornish Pepper&quot;,
            &quot;Cotherstone&quot;, &quot;Cotija&quot;, &quot;Cottage Cheese&quot;, &quot;Cottage Cheese (Australian)&quot;,
            &quot;Cougar Gold&quot;, &quot;Coulommiers&quot;, &quot;Coverdale&quot;, &quot;Crayeux de Roncq&quot;, &quot;Cream Cheese&quot;,
            &quot;Cream Havarti&quot;, &quot;Crema Agria&quot;, &quot;Crema Mexicana&quot;, &quot;Creme Fraiche&quot;, &quot;Crescenza&quot;,
            &quot;Croghan&quot;, &quot;Crottin de Chavignol&quot;, &quot;Crottin du Chavignol&quot;, &quot;Crowdie&quot;, &quot;Crowley&quot;,
            &quot;Cuajada&quot;, &quot;Curd&quot;, &quot;Cure Nantais&quot;, &quot;Curworthy&quot;, &quot;Cwmtawe Pecorino&quot;,
            &quot;Cypress Grove Chevre&quot;, &quot;Danablu (Danish Blue)&quot;, &quot;Danbo&quot;, &quot;Danish Fontina&quot;,
            &quot;Daralagjazsky&quot;, &quot;Dauphin&quot;, &quot;Delice des Fiouves&quot;, &quot;Denhany Dorset Drum&quot;, &quot;Derby&quot;,
            &quot;Dessertnyj Belyj&quot;, &quot;Devon Blue&quot;, &quot;Devon Garland&quot;, &quot;Dolcelatte&quot;, &quot;Doolin&quot;,
            &quot;Doppelrhamstufel&quot;, &quot;Dorset Blue Vinney&quot;, &quot;Double Gloucester&quot;, &quot;Double Worcester&quot;,
            &quot;Dreux a la Feuille&quot;, &quot;Dry Jack&quot;, &quot;Duddleswell&quot;, &quot;Dunbarra&quot;, &quot;Dunlop&quot;, &quot;Dunsyre Blue&quot;,
            &quot;Duroblando&quot;, &quot;Durrus&quot;, &quot;Dutch Mimolette (Commissiekaas)&quot;, &quot;Edam&quot;, &quot;Edelpilz&quot;,
            &quot;Emental Grand Cru&quot;, &quot;Emlett&quot;, &quot;Emmental&quot;, &quot;Epoisses de Bourgogne&quot;, &quot;Esbareich&quot;,
            &quot;Esrom&quot;, &quot;Etorki&quot;, &quot;Evansdale Farmhouse Brie&quot;, &quot;Evora De L'Alentejo&quot;, &quot;Exmoor Blue&quot;,
            &quot;Explorateur&quot;, &quot;Feta&quot;, &quot;Feta (Australian)&quot;, &quot;Figue&quot;, &quot;Filetta&quot;, &quot;Fin-de-Siecle&quot;,
            &quot;Finlandia Swiss&quot;, &quot;Finn&quot;, &quot;Fiore Sardo&quot;, &quot;Fleur du Maquis&quot;, &quot;Flor de Guia&quot;,
            &quot;Flower Marie&quot;, &quot;Folded&quot;, &quot;Folded cheese with mint&quot;, &quot;Fondant de Brebis&quot;,
            &quot;Fontainebleau&quot;, &quot;Fontal&quot;, &quot;Fontina Val d'Aosta&quot;, &quot;Formaggio di capra&quot;, &quot;Fougerus&quot;,
            &quot;Four Herb Gouda&quot;, &quot;Fourme d' Ambert&quot;, &quot;Fourme de Haute Loire&quot;, &quot;Fourme de Montbrison&quot;,
            &quot;Fresh Jack&quot;, &quot;Fresh Mozzarella&quot;, &quot;Fresh Ricotta&quot;, &quot;Fresh Truffles&quot;, &quot;Fribourgeois&quot;,
            &quot;Friesekaas&quot;, &quot;Friesian&quot;, &quot;Friesla&quot;, &quot;Frinault&quot;, &quot;Fromage a Raclette&quot;, &quot;Fromage Corse&quot;,
            &quot;Fromage de Montagne de Savoie&quot;, &quot;Fromage Frais&quot;, &quot;Fruit Cream Cheese&quot;,
            &quot;Frying Cheese&quot;, &quot;Fynbo&quot;, &quot;Gabriel&quot;, &quot;Galette du Paludier&quot;, &quot;Galette Lyonnaise&quot;,
            &quot;Galloway Goat's Milk Gems&quot;, &quot;Gammelost&quot;, &quot;Gaperon a l'Ail&quot;, &quot;Garrotxa&quot;, &quot;Gastanberra&quot;,
            &quot;Geitost&quot;, &quot;Gippsland Blue&quot;, &quot;Gjetost&quot;, &quot;Gloucester&quot;, &quot;Golden Cross&quot;, &quot;Gorgonzola&quot;,
            &quot;Gornyaltajski&quot;, &quot;Gospel Green&quot;, &quot;Gouda&quot;, &quot;Goutu&quot;, &quot;Gowrie&quot;, &quot;Grabetto&quot;, &quot;Graddost&quot;,
            &quot;Grafton Village Cheddar&quot;, &quot;Grana&quot;, &quot;Grana Padano&quot;, &quot;Grand Vatel&quot;,
            &quot;Grataron d' Areches&quot;, &quot;Gratte-Paille&quot;, &quot;Graviera&quot;, &quot;Greuilh&quot;, &quot;Greve&quot;,
            &quot;Gris de Lille&quot;, &quot;Gruyere&quot;, &quot;Gubbeen&quot;, &quot;Guerbigny&quot;, &quot;Halloumi&quot;,
            &quot;Halloumy (Australian)&quot;, &quot;Haloumi-Style Cheese&quot;, &quot;Harbourne Blue&quot;, &quot;Havarti&quot;,
            &quot;Heidi Gruyere&quot;, &quot;Hereford Hop&quot;, &quot;Herrgardsost&quot;, &quot;Herriot Farmhouse&quot;, &quot;Herve&quot;,
            &quot;Hipi Iti&quot;, &quot;Hubbardston Blue Cow&quot;, &quot;Hushallsost&quot;, &quot;Iberico&quot;, &quot;Idaho Goatster&quot;,
            &quot;Idiazabal&quot;, &quot;Il Boschetto al Tartufo&quot;, &quot;Ile d'Yeu&quot;, &quot;Isle of Mull&quot;, &quot;Jarlsberg&quot;,
            &quot;Jermi Tortes&quot;, &quot;Jibneh Arabieh&quot;, &quot;Jindi Brie&quot;, &quot;Jubilee Blue&quot;, &quot;Juustoleipa&quot;,
            &quot;Kadchgall&quot;, &quot;Kaseri&quot;, &quot;Kashta&quot;, &quot;Kefalotyri&quot;, &quot;Kenafa&quot;, &quot;Kernhem&quot;, &quot;Kervella Affine&quot;,
            &quot;Kikorangi&quot;, &quot;King Island Cape Wickham Brie&quot;, &quot;King River Gold&quot;, &quot;Klosterkaese&quot;,
            &quot;Knockalara&quot;, &quot;Kugelkase&quot;, &quot;L'Aveyronnais&quot;, &quot;L'Ecir de l'Aubrac&quot;, &quot;La Taupiniere&quot;,
            &quot;La Vache Qui Rit&quot;, &quot;Laguiole&quot;, &quot;Lairobell&quot;, &quot;Lajta&quot;, &quot;Lanark Blue&quot;, &quot;Lancashire&quot;,
            &quot;Langres&quot;, &quot;Lappi&quot;, &quot;Laruns&quot;, &quot;Lavistown&quot;, &quot;Le Brin&quot;, &quot;Le Fium Orbo&quot;, &quot;Le Lacandou&quot;,
            &quot;Le Roule&quot;, &quot;Leafield&quot;, &quot;Lebbene&quot;, &quot;Leerdammer&quot;, &quot;Leicester&quot;, &quot;Leyden&quot;, &quot;Limburger&quot;,
            &quot;Lincolnshire Poacher&quot;, &quot;Lingot Saint Bousquet d'Orb&quot;, &quot;Liptauer&quot;, &quot;Little Rydings&quot;,
            &quot;Livarot&quot;, &quot;Llanboidy&quot;, &quot;Llanglofan Farmhouse&quot;, &quot;Loch Arthur Farmhouse&quot;,
            &quot;Loddiswell Avondale&quot;, &quot;Longhorn&quot;, &quot;Lou Palou&quot;, &quot;Lou Pevre&quot;, &quot;Lyonnais&quot;, &quot;Maasdam&quot;,
            &quot;Macconais&quot;, &quot;Mahoe Aged Gouda&quot;, &quot;Mahon&quot;, &quot;Malvern&quot;, &quot;Mamirolle&quot;, &quot;Manchego&quot;,
            &quot;Manouri&quot;, &quot;Manur&quot;, &quot;Marble Cheddar&quot;, &quot;Marbled Cheeses&quot;, &quot;Maredsous&quot;, &quot;Margotin&quot;,
            &quot;Maribo&quot;, &quot;Maroilles&quot;, &quot;Mascares&quot;, &quot;Mascarpone&quot;, &quot;Mascarpone (Australian)&quot;,
            &quot;Mascarpone Torta&quot;, &quot;Matocq&quot;, &quot;Maytag Blue&quot;, &quot;Meira&quot;, &quot;Menallack Farmhouse&quot;,
            &quot;Menonita&quot;, &quot;Meredith Blue&quot;, &quot;Mesost&quot;, &quot;Metton (Cancoillotte)&quot;, &quot;Meyer Vintage Gouda&quot;,
            &quot;Mihalic Peynir&quot;, &quot;Milleens&quot;, &quot;Mimolette&quot;, &quot;Mine-Gabhar&quot;, &quot;Mini Baby Bells&quot;, &quot;Mixte&quot;,
            &quot;Molbo&quot;, &quot;Monastery Cheeses&quot;, &quot;Mondseer&quot;, &quot;Mont D'or Lyonnais&quot;, &quot;Montasio&quot;,
            &quot;Monterey Jack&quot;, &quot;Monterey Jack Dry&quot;, &quot;Morbier&quot;, &quot;Morbier Cru de Montagne&quot;,
            &quot;Mothais a la Feuille&quot;, &quot;Mozzarella&quot;, &quot;Mozzarella (Australian)&quot;,
            &quot;Mozzarella di Bufala&quot;, &quot;Mozzarella Fresh, in water&quot;, &quot;Mozzarella Rolls&quot;, &quot;Munster&quot;,
            &quot;Murol&quot;, &quot;Mycella&quot;, &quot;Myzithra&quot;, &quot;Naboulsi&quot;, &quot;Nantais&quot;, &quot;Neufchatel&quot;,
            &quot;Neufchatel (Australian)&quot;, &quot;Niolo&quot;, &quot;Nokkelost&quot;, &quot;Northumberland&quot;, &quot;Oaxaca&quot;,
            &quot;Olde York&quot;, &quot;Olivet au Foin&quot;, &quot;Olivet Bleu&quot;, &quot;Olivet Cendre&quot;,
            &quot;Orkney Extra Mature Cheddar&quot;, &quot;Orla&quot;, &quot;Oschtjepka&quot;, &quot;Ossau Fermier&quot;, &quot;Ossau-Iraty&quot;,
            &quot;Oszczypek&quot;, &quot;Oxford Blue&quot;, &quot;P'tit Berrichon&quot;, &quot;Palet de Babligny&quot;, &quot;Paneer&quot;, &quot;Panela&quot;,
            &quot;Pannerone&quot;, &quot;Pant ys Gawn&quot;, &quot;Parmesan (Parmigiano)&quot;, &quot;Parmigiano Reggiano&quot;,
            &quot;Pas de l'Escalette&quot;, &quot;Passendale&quot;, &quot;Pasteurized Processed&quot;, &quot;Pate de Fromage&quot;,
            &quot;Patefine Fort&quot;, &quot;Pave d'Affinois&quot;, &quot;Pave d'Auge&quot;, &quot;Pave de Chirac&quot;, &quot;Pave du Berry&quot;,
            &quot;Pecorino&quot;, &quot;Pecorino in Walnut Leaves&quot;, &quot;Pecorino Romano&quot;, &quot;Peekskill Pyramid&quot;,
            &quot;Pelardon des Cevennes&quot;, &quot;Pelardon des Corbieres&quot;, &quot;Penamellera&quot;, &quot;Penbryn&quot;,
            &quot;Pencarreg&quot;, &quot;Perail de Brebis&quot;, &quot;Petit Morin&quot;, &quot;Petit Pardou&quot;, &quot;Petit-Suisse&quot;,
            &quot;Picodon de Chevre&quot;, &quot;Picos de Europa&quot;, &quot;Piora&quot;, &quot;Pithtviers au Foin&quot;,
            &quot;Plateau de Herve&quot;, &quot;Plymouth Cheese&quot;, &quot;Podhalanski&quot;, &quot;Poivre d'Ane&quot;, &quot;Polkolbin&quot;,
            &quot;Pont l'Eveque&quot;, &quot;Port Nicholson&quot;, &quot;Port-Salut&quot;, &quot;Postel&quot;, &quot;Pouligny-Saint-Pierre&quot;,
            &quot;Pourly&quot;, &quot;Prastost&quot;, &quot;Pressato&quot;, &quot;Prince-Jean&quot;, &quot;Processed Cheddar&quot;, &quot;Provolone&quot;,
            &quot;Provolone (Australian)&quot;, &quot;Pyengana Cheddar&quot;, &quot;Pyramide&quot;, &quot;Quark&quot;,
            &quot;Quark (Australian)&quot;, &quot;Quartirolo Lombardo&quot;, &quot;Quatre-Vents&quot;, &quot;Quercy Petit&quot;,
            &quot;Queso Blanco&quot;, &quot;Queso Blanco con Frutas --Pina y Mango&quot;, &quot;Queso de Murcia&quot;,
            &quot;Queso del Montsec&quot;, &quot;Queso del Tietar&quot;, &quot;Queso Fresco&quot;, &quot;Queso Fresco (Adobera)&quot;,
            &quot;Queso Iberico&quot;, &quot;Queso Jalapeno&quot;, &quot;Queso Majorero&quot;, &quot;Queso Media Luna&quot;,
            &quot;Queso Para Frier&quot;, &quot;Queso Quesadilla&quot;, &quot;Rabacal&quot;, &quot;Raclette&quot;, &quot;Ragusano&quot;, &quot;Raschera&quot;,
            &quot;Reblochon&quot;, &quot;Red Leicester&quot;, &quot;Regal de la Dombes&quot;, &quot;Reggianito&quot;, &quot;Remedou&quot;,
            &quot;Requeson&quot;, &quot;Richelieu&quot;, &quot;Ricotta&quot;, &quot;Ricotta (Australian)&quot;, &quot;Ricotta Salata&quot;, &quot;Ridder&quot;,
            &quot;Rigotte&quot;, &quot;Rocamadour&quot;, &quot;Rollot&quot;, &quot;Romano&quot;, &quot;Romans Part Dieu&quot;, &quot;Roncal&quot;, &quot;Roquefort&quot;,
            &quot;Roule&quot;, &quot;Rouleau De Beaulieu&quot;, &quot;Royalp Tilsit&quot;, &quot;Rubens&quot;, &quot;Rustinu&quot;, &quot;Saaland Pfarr&quot;,
            &quot;Saanenkaese&quot;, &quot;Saga&quot;, &quot;Sage Derby&quot;, &quot;Sainte Maure&quot;, &quot;Saint-Marcellin&quot;,
            &quot;Saint-Nectaire&quot;, &quot;Saint-Paulin&quot;, &quot;Salers&quot;, &quot;Samso&quot;, &quot;San Simon&quot;, &quot;Sancerre&quot;,
            &quot;Sap Sago&quot;, &quot;Sardo&quot;, &quot;Sardo Egyptian&quot;, &quot;Sbrinz&quot;, &quot;Scamorza&quot;, &quot;Schabzieger&quot;, &quot;Schloss&quot;,
            &quot;Selles sur Cher&quot;, &quot;Selva&quot;, &quot;Serat&quot;, &quot;Seriously Strong Cheddar&quot;, &quot;Serra da Estrela&quot;,
            &quot;Sharpam&quot;, &quot;Shelburne Cheddar&quot;, &quot;Shropshire Blue&quot;, &quot;Siraz&quot;, &quot;Sirene&quot;, &quot;Smoked Gouda&quot;,
            &quot;Somerset Brie&quot;, &quot;Sonoma Jack&quot;, &quot;Sottocenare al Tartufo&quot;, &quot;Soumaintrain&quot;,
            &quot;Sourire Lozerien&quot;, &quot;Spenwood&quot;, &quot;Sraffordshire Organic&quot;, &quot;St. Agur Blue Cheese&quot;,
            &quot;Stilton&quot;, &quot;Stinking Bishop&quot;, &quot;String&quot;, &quot;Sussex Slipcote&quot;, &quot;Sveciaost&quot;, &quot;Swaledale&quot;,
            &quot;Sweet Style Swiss&quot;, &quot;Swiss&quot;, &quot;Syrian (Armenian String)&quot;, &quot;Tala&quot;, &quot;Taleggio&quot;, &quot;Tamie&quot;,
            &quot;Tasmania Highland Chevre Log&quot;, &quot;Taupiniere&quot;, &quot;Teifi&quot;, &quot;Telemea&quot;, &quot;Testouri&quot;,
            &quot;Tete de Moine&quot;, &quot;Tetilla&quot;, &quot;Texas Goat Cheese&quot;, &quot;Tibet&quot;, &quot;Tillamook Cheddar&quot;,
            &quot;Tilsit&quot;, &quot;Timboon Brie&quot;, &quot;Toma&quot;, &quot;Tomme Brulee&quot;, &quot;Tomme d'Abondance&quot;,
            &quot;Tomme de Chevre&quot;, &quot;Tomme de Romans&quot;, &quot;Tomme de Savoie&quot;, &quot;Tomme des Chouans&quot;, &quot;Tommes&quot;,
            &quot;Torta del Casar&quot;, &quot;Toscanello&quot;, &quot;Touree de L'Aubier&quot;, &quot;Tourmalet&quot;,
            &quot;Trappe (Veritable)&quot;, &quot;Trois Cornes De Vendee&quot;, &quot;Tronchon&quot;, &quot;Trou du Cru&quot;, &quot;Truffe&quot;,
            &quot;Tupi&quot;, &quot;Turunmaa&quot;, &quot;Tymsboro&quot;, &quot;Tyn Grug&quot;, &quot;Tyning&quot;, &quot;Ubriaco&quot;, &quot;Ulloa&quot;,
            &quot;Vacherin-Fribourgeois&quot;, &quot;Valencay&quot;, &quot;Vasterbottenost&quot;, &quot;Venaco&quot;, &quot;Vendomois&quot;,
            &quot;Vieux Corse&quot;, &quot;Vignotte&quot;, &quot;Vulscombe&quot;, &quot;Waimata Farmhouse Blue&quot;,
            &quot;Washed Rind Cheese (Australian)&quot;, &quot;Waterloo&quot;, &quot;Weichkaese&quot;, &quot;Wellington&quot;,
            &quot;Wensleydale&quot;, &quot;White Stilton&quot;, &quot;Whitestone Farmhouse&quot;, &quot;Wigmore&quot;, &quot;Woodside Cabecou&quot;,
            &quot;Xanadu&quot;, &quot;Xynotyro&quot;, &quot;Yarg Cornish&quot;, &quot;Yarra Valley Pyramid&quot;, &quot;Yorkshire Blue&quot;,
            &quot;Zamorano&quot;, &quot;Zanetti Grana Padano&quot;, &quot;Zanetti Parmigiano Reggiano&quot;
    };

}
</pre>
<p>3.)	Write following into main.xml:</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;match_parent&quot;
    android:layout_height=&quot;match_parent&quot;&gt;

    &lt;TextView
        android:layout_width=&quot;match_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:text=&quot;This activity demonstrates splitting touch events across multiple views within a view group.&quot;/&gt;

    &lt;LinearLayout
        android:orientation=&quot;horizontal&quot;
        android:layout_width=&quot;match_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:splitMotionEvents=&quot;true&quot;&gt;
        &lt;ListView android:id=&quot;@+id/list1&quot;
                  android:layout_width=&quot;0dip&quot;
                  android:layout_height=&quot;match_parent&quot;
                  android:layout_weight=&quot;1&quot; /&gt;
        &lt;ListView android:id=&quot;@+id/list2&quot;
                  android:layout_width=&quot;0dip&quot;
                  android:layout_height=&quot;match_parent&quot;
                  android:layout_weight=&quot;1&quot; /&gt;
    &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</pre>
<p>4.)	Create and write following into values\arrays.xml:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;resources&gt;
&lt;string-array name=&quot;cheese_responses&quot;&gt;
        &lt;item&gt;I\'m afraid we\'re fresh out.&lt;/item&gt;
        &lt;item&gt;I\'m afraid we never have that at the end of the week, sir.  We get it fresh on Monday.&lt;/item&gt;
        &lt;item&gt;Ah. It\'s been on order, sir, for two weeks.  I was expecting it this morning.&lt;/item&gt;
        &lt;item&gt;Normally, sir, yes.  Today the van broke down.&lt;/item&gt;
        &lt;item&gt;No.&lt;/item&gt;
        &lt;item&gt;No.&lt;/item&gt;
        &lt;item&gt;No.&lt;/item&gt;
        &lt;item&gt;Yes, sir.  It\'s, ah ..... it\'s a bit runny.&lt;/item&gt;
        &lt;item&gt;Well, it\'s very runny, actually, sir.&lt;/item&gt;
        &lt;item&gt;I think it\'s a bit runnier than you\'ll like it, sir.&lt;/item&gt;
        &lt;item&gt;Oh... The cat\'s eaten it.&lt;/item&gt;
        &lt;item&gt;No.&lt;/item&gt;
        &lt;item&gt;No.&lt;/item&gt;
        &lt;item&gt;No.&lt;/item&gt;
        &lt;item&gt;Mmm... cheese.&lt;/item&gt;
    &lt;/string-array&gt;
    
    
&lt;/resources&gt;
</pre>
<p>5.)	Write following into strings.xml:</p>
<pre class="brush: java; title: ; notranslate">
&lt;string name=&quot;split_touch_view_cheese_toast&quot;&gt;Do you have any %1$s?\n%2$s&lt;/string&gt;
</pre>
<p>6.)	Run for output.</p>
<p><strong>Steps:</strong></p>
<p>1.) Create a project named SplittingTouchExample and set the information as stated in the image.</p>
<p>	Build Target: Android 4.0<br />
	Application Name: SplittingTouchExample<br />
	Package Name: com. example. SplittingTouchExample<br />
	Activity Name: SplittingTouchExampleActivity<br />
	Min SDK Version: 14</p>
<p> <a href="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch1.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch1-300x159.png" alt="" title="splittingtouch1" width="300" height="159" class="alignnone size-medium wp-image-1759" /></a></p>
<p>2.) Open SplittingTouchExampleActivity.java file and write following code there:</p>
<pre class="brush: java; title: ; notranslate">
package com.example.SplittingTouchExample;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class SplittingTouchExampleActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);
        ListView list1 = (ListView) findViewById(R.id.list1);
        ListView list2 = (ListView) findViewById(R.id.list2);
        ListAdapter adapter = new ArrayAdapter&lt;String&gt;(this,
                android.R.layout.simple_list_item_1, Cheeses.sCheeseStrings);
        list1.setAdapter(adapter);
        list2.setAdapter(adapter);

        list1.setOnItemClickListener(itemClickListener);
        list2.setOnItemClickListener(itemClickListener);
    }

    private int responseIndex = 0;

    private final OnItemClickListener itemClickListener = new OnItemClickListener() {
        public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
            String[] responses = getResources().getStringArray(R.array.cheese_responses);
            String response = responses[responseIndex++ % responses.length];

            String message = getResources().getString(R.string.split_touch_view_cheese_toast,
                    Cheeses.sCheeseStrings[position], response);

            Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT);
            toast.show();
        }
    };
}

</pre>
<p>3.) Compile and build the project.</p>
<p><strong>Output</strong></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch2.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch2-300x267.png" alt="" title="splittingtouch2" width="300" height="267" class="alignnone size-medium wp-image-1760" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch3.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch3-300x267.png" alt="" title="splittingtouch3" width="300" height="267" class="alignnone size-medium wp-image-1761" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch4.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch4-300x267.png" alt="" title="splittingtouch4" width="300" height="267" class="alignnone size-medium wp-image-1762" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch5.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch5-300x267.png" alt="" title="splittingtouch5" width="300" height="267" class="alignnone size-medium wp-image-1763" /></a></p>
<p><a href="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch6.png"><img src="http://www.edumobile.org/android/wp-content/uploads/2012/06/splittingtouch6-300x267.png" alt="" title="splittingtouch6" width="300" height="267" class="alignnone size-medium wp-image-1764" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/android/android-development/splitting-touch-example-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
