Apps Ask user to select a random letter

Hi,

I need to ask a user to select a random letter from the alphabet and then display a success or fail notation if they choose the correct letter.

At the moment I have the code asking to choose a letter using audio when a button is clicked.

Has anyone any advice or can point me in the direction to get some?

Any help is greatly appreciated.
 
Last edited:
D

Deleted User

Guest
What part of this do you need help with? And some code would be helpful to explain what you have already done.
 

DubInTheMiddle

Lurker
Thread starter
At the moment I have a button when pressed asks the user to pick a random letter. What I need is for the user to select the letter that was asked and if they guess correct they get a "Well done" message and if fail asked to try again.
This example only has 6 letters in it.

Code:
//On click for the button random letter message

public void onClickRandom(View v){
    int rando = (int) (Math.random()*6);
    if(rando == 1){
        play_s.start();
    }else if (rando ==2){
        play_t.start();
    }else if (rando ==3){
        play_p.start();
    }else if (rando ==4){
        play_i.start();
    }else if (rando ==5){
        play_n.start();
    }else {
        play_a.start();
    }

}
 
D

Deleted User

Guest
Sorry still a bit confused as to what you are asking here. The above code appears to play one of six audio files at random.
Are you asking how to allow the user to enter a letter? For that you will need an EditText component, which is pretty simple.
How do you wish to display the 'well done' message? Could be in a popup dialog, or a text box.
 

DubInTheMiddle

Lurker
Thread starter
The user just needs to select a letter. Please see they attached. It might clear it up a bit.

Pop up dialogue and play a sound would be what I am aiming for.
 

Attachments

  • Untitled.png
    Untitled.png
    77.4 KB · Views: 53
D

Deleted User

Guest
With all due respect mate, these things are easily found with Google. Just search for 'Android popup dialog' and you'll get tons of pages telling you how to do it.
What kind of answers are you expecting here?
 

DubInTheMiddle

Lurker
Thread starter
It's not just a pop up I am looking for. The letter that is asked needs to matched what is chosen by the user. I'm not sure how to do that.
 
D

Deleted User

Guest
So your question is how to compare two char variables? Are you really saying you're not sure how to do that?
 

DubInTheMiddle

Lurker
Thread starter
I know how to compare chars but what I am doing is comparing the contents of two buttons after they where clicked. So the first button asks a random letter and the user selects the same letter through a different button and they have to match.
 
Top