[Java for Android App Development] Psykic:
okay I need help....

I'm a beginner to Android and Java (both of them and I am learning....)

So I thought of making a simple app but its got an annoying problem...

Its a calculator so it has some number keys ...the problem is that different keys give out different numbers like 2 prints out 9

MainActivity

package com.aN.calculator1;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity implements OnClickListener {

Button mb1, mb2, mb3, mb4, mb5, mb6, mb7, mb8, mb9, mb10, mb11, mb12, mb13, mb14, mb15, mb16 ;
TextView mTextView1 ;

[MENTION=439709]override[/MENTION]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mTextView1 = (TextView)findViewById(R.id.textView1);

mb1 = (Button)findViewById(R.id.b1);
mb2 = (Button)findViewById(R.id.b2);
mb3 = (Button)findViewById(R.id.b3);
mb4 = (Button)findViewById(R.id.b4);
mb5 = (Button)findViewById(R.id.b5);
mb6 = (Button)findViewById(R.id.b6);
mb7 = (Button)findViewById(R.id.b7);
mb8 = (Button)findViewById(R.id.b8);
mb9 = (Button)findViewById(R.id.b9);
mb10 = (Button)findViewById(R.id.b10);
mb11 = (Button)findViewById(R.id.b11);
mb12 = (Button)findViewById(R.id.b12);
mb13 = (Button)findViewById(R.id.b13);
mb14 = (Button)findViewById(R.id.b14);
mb15 = (Button)findViewById(R.id.b15);
mb16 =(Button)findViewById(R.id.b16);

mb1.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

mTextView1.setText("");

}
});

mb2.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 != null || !mTextView1.getText().equals(""))
{
mTextView1.append("1");
}else {
mTextView1.setText("1");
}

}
});

mb3.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 !=null || !mTextView1.getText().equals(""))
{
mTextView1.append("2");
}
else {
mTextView1.setText("2");
}
}
});

mb4.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 !=null || !mTextView1.getText().equals(""))
{
mTextView1.append("3");
}
else {
mTextView1.setText("3");
}

}
});

mb5.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 !=null || !mTextView1.getText().equals(""))
{
mTextView1.append( "4");
}
else {
mTextView1.setText("4");
}

}
});

mb6.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 !=null || !mTextView1.getText().equals(""))
{
mTextView1.append("5");
}
else {
mTextView1.setText("5");
}

}
});

mb7.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 !=null || !mTextView1.getText().equals(""))
{
mTextView1.append("6");
}
else {
mTextView1.setText("6");
}

}
});

mb8.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 !=null || !mTextView1.getText().equals(""))
{
mTextView1.append("7");
}
else {
mTextView1.setText("7");
}

}
});

mb9.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 !=null || !mTextView1.getText().equals(""))
{
mTextView1.append("8");
}
else {
mTextView1.setText("8");
}

}
});

mb10.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 !=null || !mTextView1.getText().equals(""))
{
mTextView1.append("9");
}
else {
mTextView1.setText("9");
}

}
});

mb12.setOnClickListener(new View.OnClickListener() {

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

if(mTextView1 !=null || !mTextView1.getText().equals(""))
{
mTextView1.append("0");
}
else {
mTextView1.setText("0");
}

}
});

}

[MENTION=439709]override[/MENTION]
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

[MENTION=439709]override[/MENTION]
public void onClick(View v) {
// TODO Auto-generated method stub

}

}

Activitymain.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rootRL"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg">

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="20dip"
android:layout_above="@+id/b1"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />

<Button
android:id="@+id/b14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignRight="@+id/b11"
android:text="/" />

<Button
android:id="@+id/b11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b14"
android:layout_alignParentLeft="true"
android:text="+" />

<Button
android:id="@+id/b16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/b13"
android:layout_alignParentRight="true"
android:layout_below="@+id/b11"
android:text="=" />

<Button
android:id="@+id/b13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/b11"
android:layout_alignBottom="@+id/b11"
android:layout_alignParentRight="true"
android:text="-" />

<Button
android:id="@+id/b12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b14"
android:layout_alignLeft="@+id/b15"
android:layout_alignRight="@+id/b15"
android:text="0" />

<Button
android:id="@+id/b4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b6"
android:layout_alignLeft="@+id/b7"
android:layout_alignParentRight="true"
android:text="3" />

<Button
android:id="@+id/b7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b9"
android:layout_alignLeft="@+id/b13"
android:layout_alignParentRight="true"
android:text="6" />

<Button
android:id="@+id/b8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b12"
android:layout_alignParentLeft="true"
android:layout_alignRight="@+id/b11"
android:text="7" />

<Button
android:id="@+id/b10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b12"
android:layout_alignLeft="@+id/b13"
android:layout_alignParentRight="true"
android:text="9" />

<Button
android:id="@+id/b5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b8"
android:layout_alignParentLeft="true"
android:layout_alignRight="@+id/b8"
android:text="4" />

<Button
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b3"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:text="Clear" />

<Button
android:id="@+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b5"
android:layout_alignParentLeft="true"
android:layout_alignRight="@+id/b5"
android:text="1" />

<Button
android:id="@+id/b3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b6"
android:layout_centerHorizontal="true"
android:text="2" />

<Button
android:id="@+id/b15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/b9"
android:layout_alignParentBottom="true"
android:text="X" />

<Button
android:id="@+id/b9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/b3"
android:layout_alignRight="@+id/b3"
android:layout_below="@+id/b6"
android:text="8" />

<Button
android:id="@+id/b6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/b8"
android:layout_alignLeft="@+id/b3"
android:layout_alignRight="@+id/b3"
android:text="5" />

</RelativeLayout>

Thanks in Advance waiting for your help