Creatinng a custom Toast view
<p>I want to create custom Toast view like</p>

<pre><code>public class SMSToast extends Activity {

    public void showToast(Context context, String message) {
        LayoutInflater inflater = getLayoutInflater();
        View layout = inflater.inflate(R.layout.toast_sms, (ViewGroup)findViewById(R.id.toast_sms_root));

        TextView text = (TextView) layout.findViewById(R.id.toast_sms_text);
        text.setText(message);

        Toast toast = new Toast(context);
        toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.setDuration(Toast.LENGTH_LONG);
        toast.setView(layout);
        toast.show();
    }
}
</code></pre>

<p>and in BroadcastReceiver on onReceive method</p>

<pre><code>SMSToast toast = new SMSToast();
                        toast.showToast(context, 
                                        "Received SMS from: " + msg_from + 
                                        " Content: " + msgBody);
</code></pre>

<p>but no message is shown when the code is called. If i use Toast then text is shown. What i am doing wrong?</p>
