Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. package com.example.shanta.testt;
  2.  
  3. import android.support.v7.app.ActionBarActivity;
  4. import android.os.Bundle;
  5. import android.view.Menu;
  6. import android.view.MenuItem;
  7. import android.view.View;
  8. import android.widget.Button;
  9. import android.widget.TextView;
  10.  
  11.  
  12. public class MainActivity extends ActionBarActivity {
  13.  
  14.  
  15. TextView textView;
  16. Button button1;
  17. Button button2;
  18. TextView Cash;
  19. TextView Infocash;
  20. TextView stop;
  21.  
  22. int money = 99;
  23. int stavka = 0;
  24.  
  25. String won = "You Won !";
  26. String loss = "You loss !";
  27. int x = 0;
  28. int y = 0;
  29.  
  30. public int[] mass = {5, 10, 25, 50, 100};
  31. public int click = 0;
  32.  
  33.  
  34. @Override
  35. protected void onCreate(Bundle savedInstanceState) {
  36. super.onCreate(savedInstanceState);
  37. setContentView(R.layout.activity_main);
  38. money = 88;
  39. stavka = 5;
  40.  
  41. Infocash = (TextView) findViewById(R.id.Infocash);
  42. Cash = (TextView) findViewById(R.id.Cash);
  43. textView = (TextView) findViewById(R.id.textView);
  44. textView = (TextView) findViewById(R.id.stop);
  45. button1 = (Button) findViewById(R.id.button);
  46. button2 = (Button) findViewById(R.id.button2);
  47.  
  48.  
  49. Cash.setText(Integer.toString(money));
  50. textView.setText(Integer.toString(stavka));
  51.  
  52. button1.setOnClickListener(new View.OnClickListener() {
  53. @Override
  54. public void onClick(View view) {
  55. if (x <= mass.length && x >= 0)
  56. {
  57. x = x+1;
  58. }else {
  59. stop.setText("No more bind's");
  60. }
  61. stavka = mass[x];
  62. textView.setText(Integer.toString(stavka));
  63. }
  64. });
  65.  
  66. button2.setOnClickListener(new View.OnClickListener() {
  67. @Override
  68. public void onClick(View view) {
  69. if (x <= mass.length && x >= 0)
  70. {
  71. x = x-1;
  72. }else {
  73. stop.setText("No more bind's");
  74. }
  75. stavka = mass[x];
  76. textView.setText(Integer.toString(stavka));
  77.  
  78.  
  79. }
  80.  
  81. });
  82.  
  83. }
  84. @Override
  85. public boolean onCreateOptionsMenu(Menu menu) {
  86. // Inflate the menu; this adds items to the action bar if it is present.
  87. getMenuInflater().inflate(R.menu.menu_main, menu);
  88. return true;
  89. }
  90.  
  91. @Override
  92. public boolean onOptionsItemSelected(MenuItem item) {
  93. // Handle action bar item clicks here. The action bar will
  94. // automatically handle clicks on the Home/Up button, so long
  95. // as you specify a parent activity in AndroidManifest.xml.
  96. int id = item.getItemId();
  97.  
  98. //noinspection SimplifiableIfStatement
  99. if (id == R.id.action_settings) {
  100. return true;
  101. }
  102.  
  103. return super.onOptionsItemSelected(item);
  104. }
  105.  
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement