Toast单例模式的实现,解决多个toast等待时间久的问题



public static Toast toast;
 
  
 
  
public static void showToast(String str){
   if(toast==null) {
      toast = Toast.makeText(BaseActivity.activity,str,Toast.LENGTH_SHORT);
   }
      toast.setText(str);
      toast.show();

}

猜你喜欢

转载自blog.csdn.net/captive_rainbow_/article/details/51955040
今日推荐