1. MainActivity.
java
public void doClick(int id)
{
String s="";
int
a=Integer.parseInt((EditText)findViewById(R.id.txta).getText().toString(
));
int
b=Integer.parseInt((EditText)findViewById(R.id.txtB).getText().toString(
));
String t="";
switch(id)
{
case R.id.btnAdditional:
a=compute(a, b, Operator.ADD);
t="+";
break;
case R.id.btnDivition:
a=compute(a, b, Operator.DIV);
2. Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/strA"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/txta"
android:layout_width="82dp"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/strB"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/txtB"
android:layout_width="81dp"
android:layout_height="wrap_content"
android:ems="10" />
<Button
android:id="@+id/btnAdditional"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/strAditional" />
<Button
android:id="@+id/btnSubstraction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/strSubstraction" />
<Button
android:id="@+id/btnMutiplication"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/strMutiplication" />
<Button
android:id="@+id/btnDivition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/strDivition" />
<TextView
android:id="@+id/lblResult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/strResult"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/txtResult"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<Button
android:id="@+id/btnClose1S"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/strClose"
android:onClick="doCloseApplication"
/>
</LinearLayout>
3. String.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Vd3</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="hello">Simple Math Application!</string>
<string name="strA">A=</string>
<string name="strB">B=</string>
<string name="strResult">Result: A+B=</string>
<string name="strAditional">A+B</string>
<string name="strSubstraction">A-B</string>
<string name="strMutiplication">A*B</string>
<string name="strDivition">A/B</string>
<string name="strClose">Close Application</string>
</resources>