How to test for the appearance of a Toast message

前端 未结 9 1487
一生所求
一生所求 2020-12-16 09:55

Would anyone know how to test for the appearance of a Toast message on an Activity?

I\'m using code similar to what the OP posted on this question for testing my pro

9条回答
  •  情书的邮戳
    2020-12-16 10:09

    I check, the following works:

    if(someToast == null)
        someToast = Toast.makeText(this, "sdfdsf", Toast.LENGTH_LONG);
    boolean isShown = someToast.getView().isShown();
    

提交回复
热议问题