Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.stackrechner;
- import android.support.v7.app.ActionBarActivity;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.MenuItem;
- private Stack zahlenStapel = new Stack ();
- public class MainActivity extends ActionBarActivity implements ActionListener {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
- @Override
- 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;
- }
- public void actionPerformed(ActionEvent event) {
- String cmd = event.getActionCommand();
- if (cmd.equals("Enter")){
- String strInhalt = R.layout.tfEingabe.getText();
- Double zahl = new Double (strInhalt);
- zahlenStapel.push(zahl);
- R.layout.tfAnzeige.setText ("");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement