Is there a way I can pop a Toast when ever a user types a particular number from the keyboard eg 999 in the android phone. I have made a research regarding this but what am seeing is to make a toast at interval or launch an app on dialing a number. Thanks
Asked
Active
Viewed 64 times
-1
-
1possible duplicate of [how to get dialed mobile number in my application?](http://stackoverflow.com/questions/9909153/how-to-get-dialed-mobile-number-in-my-application) – Rohit5k2 Aug 17 '15 at 14:05
-
Before asking question,Please search – IntelliJ Amiya Aug 17 '15 at 14:06
-
There are two many answers already available for this. – Rohit5k2 Aug 17 '15 at 14:07
2 Answers
1
This is how you can make a toast , when the user enters a numeric value equal to 999 , this will throw a toast.The toast can be thrown at a button click, the button click method(onButtonClick()).
public void onButtonClick(View View) {
final EditText numberText= (EditText) findViewById(R.id.numberInputEditBox);
if (numberText.equals(999)) {
Toast.makeText(getApplicationContext(), "You Have Entered The Number 999!", Toast.LENGTH_SHORT).show();
}
}

Utkarsh mor
- 11
- 3
0
On your edit text add an aftertextchangelistener using addTextChangeListener() method. And if the text input equals "999" you can show your toast message.

Thomas R.
- 7,988
- 3
- 30
- 39