Android Toast message not appearing on first request
i am having a problem whereby 开发者_JAVA百科when i open my app from the main screen, whether for the first time or not, when i click one of the buttons to show a toast message, the first time i click the button the toast message doesnt appear but it does appear for the 2nd and every subsequent click. if i then go home and launch my app again i have to wait for the 2 click to see a toast. does anyone know why this may be?
this is how i am using the toast class..
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, msg, duration);
toast.show();
Make sure you are properly initializing the variable msg.
精彩评论