- iPhone topik
- Apple Watch Sport - ez is csak egy okosóra
- Apple iPhone 17 Pro Max – fennsík
- Milyen okostelefont vegyek?
- Homokféreggel is pózolhatna a OnePlus 15
- Szerkesztett és makrofotók mobillal
- Yettel topik
- Apple iPhone Air - almacsutka
- One mobilszolgáltatások
- Huawei Watch GT 6 és GT 6 Pro duplateszt
Új hozzászólás Aktív témák
-
lanszelot
addikt
válasz
axioma #12099 üzenetére
de nem int-et adtam meg.
one, two, three, four, five - ezek az id-k amiket megadtam.itt a progi.
Persze nem így lesz, csak most for -al csináltam, hogy azt is gyakoroljam.
De a for nem jó, for helyett method kell nekem majd.ImageView viewNr[] = new ImageView[5];
int imgId[] = new int[]{R.drawable.one, R.drawable.two, R.drawable.three, R.drawable.four, R.drawable.five, R.drawable.six};
public void kockaAkcio(int v, int r){
switch(r) {
case 0:
viewNr[v].setImageResource(imgId[0]);
break;
case 1:
viewNr[v].setImageResource(imgId[1]);
break;
case 2:
viewNr[v].setImageResource(imgId[2]);
break;
case 3:
viewNr[v].setImageResource(imgId[3]);
break;
case 4:
viewNr[v].setImageResource(imgId[4]);
break;
case 5:
viewNr[v].setImageResource(imgId[5]);
break;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
Random random = new Random();
ImageView imageView1 = findViewById(R.id.Egyes);
ImageView imageView2 = findViewById(R.id.Kettes);
ImageView imageView3 = findViewById(R.id.Harmas);
ImageView imageView4 = findViewById(R.id.Negyes);
ImageView imageView5 = findViewById(R.id.Otos);
Button button01 = findViewById(R.id.Dobas);
button01.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int[] kockak = new int[5];
int randSzam = random.nextInt(5);
//itt hozom letre a kepek helyenek a valtozot es tombbe rakom tombben
viewNr[0] = imageView1;
viewNr[1] = imageView2;
viewNr[2] = imageView3;
viewNr[3] = imageView4;
viewNr[4] = imageView5;
for (int i =0; i<5; i++){
randSzam = random.nextInt(5);
//itt rakom be a dobast
kockak[i] = randSzam;
//itt hivom a methodot
kockaAkcio(i, randSzam);
}
}
});
}
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- S.T.A.L.K.E.R. 2: Heart of Chornobyl
- GeForce RTX 5060: Ezt kapjuk 150 ezerért
- urandom0: Kicsit most elfáradtam...
- Win 10 LTSC: hülye vagyok?
- Akciókamerák
- Kerékpárosok, bringások ide!
- Mikrotik routerek
- Milyen légkondit a lakásba?
- Battlefield 2042
- btz: Internet fejlesztés országosan!
- További aktív témák...
- Bomba ár! Acer Aspire ES1 - AMD A8 I 8GB I 180GB SSD I 15,6" HD I HDMI I Cam I W10 I Garancia!
- Acer Predator Helios 300 - PH315-51
- Bomba Ár! Fujitsu LifeBook S762 - i5-3GEN I 8GB I 320GB I DVDRW I 13,3" HD I DP I W10 I Garancia!
- Bomba ár! Dell Latitude E6540 - i7-4GEN I 8GB I 256SSD I Radeon I 15,6" FHD I Cam I W10 I Garancia!
- Bomba ár! Dell Latitude E6510 - i7 I 4GB I 250GB I DVDRW I Nvidia I 15,6" HD+ I Cam I W10 I Gari!
- REFURBISHED és ÚJ - HP USB-C Dock G5 docking station (5TW10AA) - 3x4K felbontás, 144Hz képfrissítés
- GYÖNYÖRŰ iPhone 12 Pro 256GB Gold -1 ÉV GARANCIA - Kártyafüggetlen, MS3438
- MikroTik CCR1009-7G-1C-1S+ Cloud Router
- HIBÁTLAN iPhone 12 mini 128GB Green -1 ÉV GARANCIA - Kártyafüggetlen, MS3400, 94% Akkumulátor
- BESZÁMÍTÁS! Asus A620M R5 7600X 32GB DDR5 1TB SSD RTX 3080 10GB Zalman M4 A-Data 750W
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest