有没有办法在 android 中获取与特定 android Toast 对象关联的消息?
toast=Toast.makeText(getAppContext(), message, Toast.LENGTH_LONG);
toast.show();
现在在我的测试类中,我想从这个 toast 对象获取消息
最佳答案
Is there a way to get the message associated with a particular android Toast object in android?
这样做:
Toast toast=Toast.makeText(getAppContext(), message, Toast.LENGTH_LONG);
toast.show();
View view = toast.getView();
TextView tv = (TextView)view.findViewById(android.R.id.message);
String strMessage=tv.getText().toString();
关于android - 从其 Toast 对象获取 toast 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29160200/