customize toast in android
<p>Iam trying to changebackground and text color of toast in my application using</p>

<pre><code>LayoutInflater infator = getLayoutInflater();
            View layout =infator.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toast_layout));
            TextView toastText = (TextView) findViewById(R.id.toasttext);
            toastText.setBackgroundColor(Color.YELLOW);
            toastText.setText("uei:"+o.getUei());
            Toast toast = new Toast(getApplicationContext());
            toast.setDuration(Toast.LENGTH_LONG);
            toast.setView(layout);
            toast.show();
</code></pre>

<p>This code is present in OnItemClickListener of my listview.</p>

<p>But the application gets force closed with null pointer exception!!</p>

<p>this is what abve the onclick listener, which could give a better picture.</p>

<pre><code>public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.alarms);
        m_alarmAdapter = new AlarmAdapter(this, R.layout.severity_item, m_alarms);
        setListAdapter(m_alarmAdapter);
        ListView lv = getListView();
                lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(final AdapterView&lt;?&gt; parent, final View view, final int position, final long id) {
                Log.d(TAG, "clicked: " + view);
                final Alarm o = m_alarmAdapter.getItem(position);
                LayoutInflater infator = getLayoutInflater();
</code></pre>
