I have an Activity main. If i call
Toast.makeText(this, "Hello World from main", Toast.LENGTH_SHORT);
this works great. However, for every other action in my application, I cannot display Toast. No exception, nothing in the magazine, but I do not see Toast.
My main activity begins with another menu with options:
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.main_menu_entry: Intent infolist = new Intent(this, infolist.class); startActivityForResult(infolist, R.layout.infolist); return true; default: return super.onOptionsItemSelected(item); } }
In my infolist activity, I have another options menu that Toast should display.
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.infolist_menu_entry: // this Toast is never shown. Toast.makeText(this, "Hello World from infolist", Toast.LENGTH_Short); return true; default: return super.onOptionsItemSelected(item); } }
Any ideas what might cause this problem? I am using the latest SDK with Min SDK Version = 3 and 1.5 emulator.
java android android-activity toast
JΓΌrgen steinblock
source share