Is it possible to get the value of string of Toast.makeText()?
问题 If possible, I'd like to put the value of it to conditional statement (if) and put some arguments inside of it. 回答1: You can do like this: Toast myToast = Toast.makeText(this, "Hellow World!!!", Toast.LENGTH_SHORT); myToast.show(); //Now the statement below gets the text displayed String displayedText = ((TextView)((LinearLayout)myToast.getView()).getChildAt(0)).getText().toString(); 来源: https://stackoverflow.com/questions/33982322/is-it-possible-to-get-the-value-of-string-of-toast-maketext