This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
private final String KLASSE = "MainActivity"; | |
private Button btnZweiteActivity; | |
@Override | |
protected void onStart() { | |
super.onStart(); | |
Log.v("XXXXX " + KLASSE, "onStart"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private TextView tvErgebnis; | |
private EditText etGroesseInCm; | |
private EditText etGewichtInKg; | |
... | |
double groesse = Double.valueOf(String.valueOf(etGroesseInCm.getText())); | |
double gewicht = Double.valueOf(String.valueOf(etGewichtInKg.getText())); | |
double ergebnis = gewicht*10000/(groesse*groesse); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
private TextView tvErgebnis; | |
private Button btnBerechnen; | |
private EditText etGroesseInCm; | |
private EditText etGewichtInKg; | |
private class myOCL implements View.OnClickListener { | |
@Override | |
public void onClick(View view) { | |
// Alternativ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
private EditText mein_eingabefeld; | |
private Button btnTxtSpeichern; | |
private TextView meine_textview; | |
private SeekBar seekBar; | |
private class myOCL implements View.OnClickListener { | |
@Override | |
public void onClick(View view) { | |
meine_textview.setText(mein_eingabefeld.getText().toString()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
// Die zu verwendenden Controls werden hier deklariert | |
private TextView lbl; | |
private Button btn; | |
private int zaehler; | |
private class MyOCL implements View.OnClickListener { | |
@Override | |
public void onClick(View view) { | |
zaehler++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Game Loss | |
def game_loss(self): | |
self.board.create_text(PLAYGROUND_WIDTH/2,PLAYGROUND_HEIGHT/2,text="Game Over"\ | |
,font=('arial 30 bold'),fill='red') | |
self.gamevalid=0 | |
return | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function For Moving Head | |
def moving_snake_head(self): | |
self.board.move(self.snake,self.x,self.y) | |
x1,y1,x2,y2=self.board.coords(self.snake) | |
if x1<=0 or y1<=0: | |
self.x=0 | |
self.y=0 | |
self.game_loss() | |
elif PLAYGROUND_HEIGHT<=y2 or PLAYGROUND_WIDTH<=x2: | |
self.x=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creating Ground | |
def creating_playground(self): | |
self.board=Tkinter.Canvas(self, width=PLAYGROUND_WIDTH, height=PLAYGROUND_HEIGHT, background=PLAYGROUND_COLOR) | |
self.board.pack(padx=10, pady=10) | |
return | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PLAYGROUND_WIDTH=300 | |
PLAYGROUND_HEIGHT=200 | |
PLAYGROUND_COLOR='white' | |
SNAKE_HEAD_COLOR='green' | |
SNAKE_BODY_COLOR='green' | |
SNAKE_MOVING_SPEED=10 | |
try: | |
import Tkinter | |
except: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wichtige Variablen | |
PLAYGROUND_WIDTH=300 | |
PLAYGROUND_HEIGHT=200 | |
PLAYGROUND_COLOR='powder blue' | |
SNAKE_HEAD_COLOR='green' | |
SNAKE_BODY_COLOR='green' | |
SNAKE_MOVING_SPEED=10 | |
# importiere module | |
try: |