Static context saved in Application class and used in a singleton toast builder, does this create a memory leak?
问题 I've got a singleton Toast-showing class, which keeps track of the current toast and cancels it when it is started again: public enum SingleToast { INSTANCE; private Toast currentToast; private String currentMessage; public void show(String message, int duration) { if (message.equals(currentMessage)) { currentToast.cancel(); } currentToast = Toast.makeText(App.getContext(), message, duration); currentToast.show(); currentMessage = message; } } (Extended explanation of this example can be