Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.shanta.testt;
- import android.support.v7.app.ActionBarActivity;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.widget.Button;
- import android.widget.TextView;
- public class MainActivity extends ActionBarActivity {
- TextView textView;
- Button button1;
- Button button2;
- TextView Cash;
- TextView Infocash;
- TextView stop;
- int money = 99;
- int stavka = 0;
- String won = "You Won !";
- String loss = "You loss !";
- int x = 0;
- int y = 0;
- public int[] mass = {5, 10, 25, 50, 100};
- public int click = 0;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- money = 88;
- stavka = 5;
- Infocash = (TextView) findViewById(R.id.Infocash);
- Cash = (TextView) findViewById(R.id.Cash);
- textView = (TextView) findViewById(R.id.textView);
- textView = (TextView) findViewById(R.id.stop);
- button1 = (Button) findViewById(R.id.button);
- button2 = (Button) findViewById(R.id.button2);
- Cash.setText(Integer.toString(money));
- textView.setText(Integer.toString(stavka));
- button1.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (x <= mass.length && x >= 0)
- {
- x = x+1;
- }else {
- stop.setText("No more bind's");
- }
- stavka = mass[x];
- textView.setText(Integer.toString(stavka));
- }
- });
- button2.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (x <= mass.length && x >= 0)
- {
- x = x-1;
- }else {
- stop.setText("No more bind's");
- }
- stavka = mass[x];
- textView.setText(Integer.toString(stavka));
- }
- });
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_main, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
- //noinspection SimplifiableIfStatement
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement