+ 1

Number Guessing Game in JAVA

I am writing random number guessing game and cant figure out as to why my method UpdateUI is lit up red? package com.example.guessmynumber; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.util.Random; public class MainActivity extends AppCompatActivity { static final int CORRECT = 0; static final int LOW = 1; static final int HIGH = 2; static final int RESET = 3; static final int MAX_NUMBER = 101; TextView userNumber, textPrevious; EditText userInput; Button submitButton; int target; Random generator; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); userNumber = findViewById(R.id.user_number); userInput = findViewById(R.id.user_input); submitButton = findViewById(R.id.submit_button); textPrevious = findViewById(R.id.text_previous); generator = new Random(); submitButton.setOnClickListener(new View.OnClickListener( ) { @Override public void onClick(View v) { if(submitButton.getText() == getString(R.string.app_name)) { int guess = Integer.parseInt(userInput.getText( ).toString( )); userInput.setText(Integer.toString(guess)); UpdateUI(checkGuess(guess)); }else{ target = generator.nextInt(MAX_NUMBER); UpdateUI(RESET); } } }); } @Override protected void onStart(){ super.onStart(); int target = generator.nextInt(MAX_NUMBER); } private int checkGuess(int guess){ if (guess == target) {

12th Apr 2019, 9:32 PM
Albert Yakubov
Albert Yakubov - avatar
4 Respostas
+ 1
Where’s the UpdateUI function? I cant find it
24th Apr 2019, 1:30 AM
Owenizedd
Owenizedd - avatar
+ 1
the UpdateUi() is not defined bro, that is why its red
27th Apr 2019, 4:46 AM
Owenizedd
Owenizedd - avatar
0
what do u mean
24th Apr 2019, 3:09 PM
Albert Yakubov
Albert Yakubov - avatar
0
Hiw would I go about doing that? Is it in styles?
27th Apr 2019, 5:41 AM
Albert Yakubov
Albert Yakubov - avatar