android Toast and View help
<p>I am trying to create a Helper class to display Toasts in my android app, as follows.</p>

<p>public class ToastHelper{</p>

<pre><code>final static Toast toastAlert(String msg) {
 LayoutInflater inflater = LayoutInflater.from(Main.self.getApplicationContext());
 View layout = inflater.inflate(R.layout.toast_layout, (ViewGroup) findViewById(R.id.toast_layout_root));

 TextView tv = (TextView)layout.findViewById(R.id.toast_text);
 tv.setText(msg);

 Toast toast = new Toast(Main.self.getApplicationContext());
 toast.setDuration(Toast.LENGTH_SHORT);
 toast.setView(layout);
 return toast;
}
</code></pre>

<p>}</p>

<pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/toast_layout_root"
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:padding="10dip"
          android:background="#FFF"
          &gt;
&lt;TextView android:id="@+id/toast_text"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent"
          android:textColor="#000"
          /&gt;
</code></pre>

<p></p>

<p>My code is based on the example at: <a href="http://developer.android.com/guide/topics/ui/notifiers/toasts.html" rel="nofollow">http://developer.android.com/guide/topics/ui/notifiers/toasts.html</a></p>

<p>My problem is, when I try to inflate the view, I can't call findViewById without the View from the activity I am calling toastAlert in. Is there a way I can access that view?</p>
