SHOW:
|
|
- or go back to the newest paste.
1 | - | private Stack zahlenStapel = new Stack (); |
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 | } |