吐司没有出现在Android 4.4奇巧

吐司没有出现在Android 4.4奇巧

问题描述:

我有一个使用吐司的应用程序,我已经使用Android 4.3测试它在三星Galaxy II,它工作正常。

I have an application that uses Toast and I have tested it on a Samsung Galaxy II using Android 4.3 and it works fine.

我最近得到了运行Android 4.4奇巧是Nexus 5,当我尝试加载吐司它不会出现。

I have recently gotten a Nexus 5 running Android 4.4 KitKat and when I try to load the Toast it doesn't appear.

的面包被删除或者改变奇巧的语法?

Has Toast been removed or the syntax altered in KitKat?

这是code我使用,使并调用吐司:

This is the code I'm using to make and call the Toast:

@Override
public boolean onMenuItemSelected(int featureId, MenuItem item)
{
    int itemId = item.getItemId();
    switch (itemId) {

    case R.id.action_settings:
        Log.e("TOAST","This was called");
        Toast.makeText(MainActivity.this, "This is my Toast message!",Toast.LENGTH_LONG).show();
        break;
    }
    return true;
}

我已经调试的code,并通过线这一部分线踩所以它肯定是被称为,但没有任何反应。

I have Debugged the code and stepped through this part line by line so it is definitely being called, but nothing happens.

使用这个而不是 getApplicationContext()