Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. package hu.bme.aut.sportislife.food;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4.  
  5. import android.os.Bundle;
  6. import android.widget.TextView;
  7.  
  8. import java.util.Random;
  9.  
  10. import hu.bme.aut.sportislife.R;
  11. import hu.bme.aut.sportislife.data.RaceEventsItem;
  12.  
  13. public class Dinner extends AppCompatActivity {
  14.  
  15. TextView menu = (TextView)findViewById(R.id.dinnermenu);
  16.  
  17. @Override
  18. protected void onCreate(Bundle savedInstanceState) {
  19. super.onCreate(savedInstanceState);
  20. setContentView(R.layout.activity_dinner);
  21.  
  22. final int random = new Random().nextInt(5) + 1;
  23.  
  24. switch (random) {
  25. case 1:
  26. menu.setText("Csulok");
  27. break;
  28. case 2:
  29. menu.setText("Alma");
  30. break;
  31. case 3:
  32. menu.setText("Körte");
  33. break;
  34. case 4:
  35. menu.setText("Narancs");
  36. break;
  37. case 5:
  38. menu.setText("Cékla");
  39. break;
  40.  
  41. }
  42.  
  43. }
  44. }
  45.  
  46.  
  47. /*
  48. //ez itt a layout
  49. <?xml version="1.0" encoding="utf-8"?>
  50. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  51. android:layout_width="match_parent"
  52. android:layout_height="match_parent"
  53. android:orientation="vertical"
  54. android:background="@drawable/deszka"
  55. android:padding="16dp">
  56.  
  57. <TextView
  58. android:layout_width="wrap_content"
  59. android:layout_height="wrap_content"
  60. android:text="EGÉSZSÉGES TÁPANYAGOK:"
  61. android:textAllCaps="true"
  62. android:textColor="#F8F7F7"
  63. android:textSize="34sp" />
  64.  
  65.  
  66. <TextView
  67. android:id="@+id/dinnermenu"
  68. android:layout_width="match_parent"
  69. android:layout_height="wrap_content"
  70. android:layout_marginBottom="20dp"
  71. android:text="Túró"
  72. android:textColor="#F8F7F7"
  73. android:textSize="20sp" />
  74.  
  75.  
  76. </LinearLayout>
  77.  
  78. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement