开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜