<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sum of two numbers using android Archives -</title>
	<atom:link href="https://mitindia.in/tag/sum-of-two-numbers-using-android/feed/" rel="self" type="application/rss+xml" />
	<link>https://mitindia.in/tag/sum-of-two-numbers-using-android/</link>
	<description></description>
	<lastBuildDate>Mon, 11 Jul 2016 11:41:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mitindia.in/wp-content/uploads/2023/03/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>sum of two numbers using android Archives -</title>
	<link>https://mitindia.in/tag/sum-of-two-numbers-using-android/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Android program SUM of 2 Numbers</title>
		<link>https://mitindia.in/android-program-sum-of-2-numbers/</link>
					<comments>https://mitindia.in/android-program-sum-of-2-numbers/#comments</comments>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Tue, 28 Jun 2016 05:55:34 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[sum of two numbers using android]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=167</guid>

					<description><![CDATA[<p>Addition of 2 numbers Step 1. in activity_main.xml file copy the following code. &#60;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"&#62; &#60;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Enter First number" android:id="@+id/t1" /&#62; &#60;EditText android:layout_width="103dp" android:layout_height="wrap_content" android:id="@+id/n1" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" /&#62; &#60;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Enter second number" android:id="@+id/t2" android:layout_gravity="center_vertical" android:layout_below="@+id/n1" android:layout_toStartOf="@+id/n1" android:layout_marginTop="39dp" /&#62; &#60;EditText android:layout_width="92dp" android:layout_height="wrap_content" android:id="@+id/n2" android:layout_gravity="center_vertical" [&#8230;]</p>
<p>The post <a href="https://mitindia.in/android-program-sum-of-2-numbers/">Android program SUM of 2 Numbers</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Addition of 2 numbers</h3>
<p>Step 1. in activity_main.xml file copy the following code.</p>
<pre>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"&gt;

    &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Enter First number"
      android:id="@+id/t1" /&gt;

    &lt;EditText
        android:layout_width="103dp"
        android:layout_height="wrap_content"
        android:id="@+id/n1"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" /&gt;

    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Enter second number"
        android:id="@+id/t2"
        android:layout_gravity="center_vertical"
        android:layout_below="@+id/n1"
        android:layout_toStartOf="@+id/n1"
        android:layout_marginTop="39dp" /&gt;

    &lt;EditText
        android:layout_width="92dp"
        android:layout_height="wrap_content"
        android:id="@+id/n2"
        android:layout_gravity="center_vertical"
        android:layout_alignTop="@+id/t2"
        android:layout_centerHorizontal="true" /&gt;

    &lt;EditText
        android:layout_width="209dp"
        android:layout_height="wrap_content"
        android:id="@+id/n3"
        android:layout_gravity="center_vertical"
        android:layout_below="@+id/n2"
        android:layout_alignRight="@+id/n2"
        android:layout_alignEnd="@+id/n2"
        android:layout_marginTop="36dp" /&gt;

    &lt;Button
        android:text="Click here"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/btn"
        android:layout_gravity="bottom"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/t1"
        android:layout_toEndOf="@+id/t1" /&gt;


&lt;/RelativeLayout&gt;

<b>step2: in the MainActivity.java enter following code</b>

 package app.mitindia.com.aop;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;


public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        final EditText ed1=(EditText)findViewById(R.id.n1);
        final EditText ed2=(EditText)findViewById(R.id.n2);
        final EditText ed3=(EditText)findViewById(R.id.n3);

        Button btn=(Button)findViewById(R.id.btn);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                int x=new Integer(ed1.getText().toString());
                int y=new Integer(ed2.getText().toString());
                int sum=x+y;
                ed3.setText(String.valueOf(sum));

            }
        });


    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}</pre>
<pre>Step 3: Now, Run the application see the following output.</pre>
<p><img fetchpriority="high" decoding="async" class="alignnone" src="https://shivkblog.files.wordpress.com/2015/06/screenshot_2015-06-24-17-41-58.png?w=169&amp;h=300" alt="Screenshot_2015-06-24-17-41-58" width="169" height="300" /></p>
<p>&nbsp;</p>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Fandroid-program-sum-of-2-numbers%2F&amp;linkname=Android%20program%20SUM%20of%202%20Numbers" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Fandroid-program-sum-of-2-numbers%2F&amp;linkname=Android%20program%20SUM%20of%202%20Numbers" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Fandroid-program-sum-of-2-numbers%2F&#038;title=Android%20program%20SUM%20of%202%20Numbers" data-a2a-url="https://mitindia.in/android-program-sum-of-2-numbers/" data-a2a-title="Android program SUM of 2 Numbers"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/android-program-sum-of-2-numbers/">Android program SUM of 2 Numbers</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mitindia.in/android-program-sum-of-2-numbers/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
