Featured post

Displaying Multiple Fragments in a single Activity

Thursday, 29 October 2015

Finding the Sum of two numbers

Demo 2:

The UI Code(activity_main.xml)

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
   
    <EditText
        android:id="@+id/editText1"
        android:hint="Enter a number"
   android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
   
    <EditText
        android:id="@+id/editText2"
        android:hint="Enter a number"
   android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
   
    <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Add"/>
   
    <TextView
        android:id="@+id/display"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Your Sum is 0"
        android:layout_gravity="center"
        android:gravity="center"
        android:paddingTop="20dp"/>
   

   
</LinearLayout>

No comments:

Post a Comment