Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.stackrechner;
  2.  
  3. import android.support.v7.app.ActionBarActivity;
  4. import android.os.Bundle;
  5. import android.view.Menu;
  6. import android.view.MenuItem;
  7.  
  8. private Stack zahlenStapel = new Stack ();
  9.  
  10. public class MainActivity extends ActionBarActivity implements ActionListener {
  11.  
  12. @Override
  13. protected void onCreate(Bundle savedInstanceState) {
  14. super.onCreate(savedInstanceState);
  15. setContentView(R.layout.activity_main);
  16. }
  17.  
  18. @Override
  19. public boolean onCreateOptionsMenu(Menu menu) {
  20. // Inflate the menu; this adds items to the action bar if it is present.
  21. getMenuInflater().inflate(R.menu.main, menu);
  22. return true;
  23. }
  24.  
  25. public void actionPerformed(ActionEvent event) {
  26. String cmd = event.getActionCommand();
  27. if (cmd.equals("Enter")){
  28. String strInhalt = R.layout.tfEingabe.getText();
  29. Double zahl = new Double (strInhalt);
  30. zahlenStapel.push(zahl);
  31. R.layout.tfAnzeige.setText ("");
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement