title: How to centralize a custom toast creation
body: <p>in my application i use a custom toast in almost all the activity. To create the custom toast i have the following method : </p>
  
  <pre><code>private void getCustomToast(String message)
  {
      LayoutInflater li   = getLayoutInflater();
      View toastlayout    = li.inflate(R.layout.toast_error, (ViewGroup)findViewById(R.id.toast_layout));
      TextView text       = (TextView) toastlayout.findViewById(R.id.toast_text);
      text.setText(message);
  
      Toast toast = new Toast(this);
      toast.setDuration(Toast.LENGTH_LONG);
      toast.setView(toastlayout);
      toast.show();
  }
  </code></pre>
  
  <p>It works fine but for each activity I need to duplicate this method, not really respectfull of the DRY principle ...</p>
  
  <p>How can i make a static class (for example) in which i have a method which gonna fire the custom toast on the current activity ?</p>
  
  <p>Thanks</p>