我有一个活动,在onResume中有以下代码:
super.onResume();
Intent intent = new Intent(this, this.getClass());
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
nfcAdapter.enableForegroundDispatch(this, pendingIntent, null,null);在onNewIntent(意图意图)函数中,我有:
super.onNewIntent(intent);
setIntent(intent)
..
...
Toast.makeText....但是烤面包没有出现--有人有解决这个问题的办法吗?
发布于 2012-07-03 16:10:54
但是Toast.makeText没有出现--有人解决了这个问题吗?
很可能忘了调用show()方法。
Toast.makeText(getApplicationContext(), "Hello", Toast.LENGTH_SHORT).show();发布于 2012-07-03 16:01:13
你可以试试这个:
CharSequence text = "Your Text";
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(getContext(), text, duration);然后,只要您想要显示您的消息,只需使用toast.show();。
希望这能有所帮助。
https://stackoverflow.com/questions/11314768
复制相似问题