Error when using Toast
<p>I use Toast to display some message but have some trouble. There is my code:</p>

<pre><code>  private Button btPush;
    private EditText etxMessage;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btPush = (Button) findViewById(R.id.btPushMe);
        btPush.setOnClickListener(sayHello);

        etxMessage = (EditText) findViewById(R.id.editText1);
    }

    View.OnClickListener sayHello = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            LayoutInflater inflated = getLayoutInflater();
            View layout = inflated.inflate(R.layout.activity_main,(ViewGroup) findViewById(R.id.layout));
            String string = etxMessage.getText().toString();
            Toast toast = new Toast(getApplicationContext());
            toast.setText(string);
            toast.setGravity(Gravity.TOP|Gravity.LEFT, 0, 0);
            toast.setDuration(Toast.LENGTH_LONG);
            toast.setView(layout);
            toast.show();
            //Toast.makeText(getApplicationContext(),string,Toast.LENGTH_SHORT).show();
        }
    };
</code></pre>

<p>If I use:</p>

<pre><code>Toast.makeText(getApplicationContext(),string,Toast.LENGTH_SHORT).show();
</code></pre>

<p>It works!</p>
