Advertisement
Guest User

מחשבון

a guest
Sep 20th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.25 KB | None | 0 0
  1. import android.R.integer;
  2. import android.R.string;
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.view.View;
  6. import android.widget.Button;
  7. import android.widget.EditText;
  8. import android.widget.TextView;
  9. import android.widget.Toast;
  10.  
  11. public class MainActivity extends Activity {
  12.  
  13.  public EditText display;  
  14. TextView edt;
  15. Integer c,d,r,b;
  16. String a="0",aa;
  17.  
  18.  
  19. Button b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16;
  20.  
  21. @Override
  22.     public void onCreate(Bundle savedInstanceState) {
  23.     super.onCreate(savedInstanceState);
  24.     setContentView(R.layout.activity_main);
  25.     edt=(EditText)findViewById(R.id.editText1);
  26.     b1=(Button)findViewById(R.id.button1);
  27.     b2=(Button)findViewById(R.id.button2);
  28.     b3=(Button)findViewById(R.id.button3);
  29.     b4=(Button)findViewById(R.id.button4);
  30.     b5=(Button)findViewById(R.id.button5);
  31.     b6=(Button)findViewById(R.id.button6);
  32.     b7=(Button)findViewById(R.id.button7);
  33.     b8=(Button)findViewById(R.id.button8);
  34.     b9=(Button)findViewById(R.id.button9);
  35.     b10=(Button)findViewById(R.id.button0);
  36.     b11=(Button)findViewById(R.id.button11);
  37.     b12=(Button)findViewById(R.id.button12);
  38.     b13=(Button)findViewById(R.id.button13);
  39.     b14=(Button)findViewById(R.id.button14);
  40.     b15=(Button)findViewById(R.id.button15);
  41.     b16=(Button)findViewById(R.id.button16);
  42.  
  43.  
  44.  
  45.     b1.setOnClickListener(new View.OnClickListener() {
  46.          public void onClick(View v) {
  47.              // TODO Auto-generated method stub
  48.  
  49.              a=edt.getText().toString();
  50.              a=a+"1";
  51.              edt.setText(a);
  52.  
  53.          }
  54.      });
  55.  
  56.      b2.setOnClickListener(new View.OnClickListener()
  57.      {
  58.  
  59.                  public void onClick(View v) {
  60.                      // TODO Auto-generated method stub
  61.  
  62.                      a=edt.getText().toString();
  63.                      a=a+"2";
  64.                      edt.setText(a);
  65.                                          }
  66.              });
  67.  
  68.      b3.setOnClickListener(new View.OnClickListener()
  69.      {
  70.  
  71.                  public void onClick(View v) {
  72.                      a=edt.getText().toString();
  73.                      a=a+"3";
  74.                      edt.setText(a);
  75.                                          }
  76.              });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement