views:

56

answers:

1

I have a Activity called main. If I call

Toast.makeText(this, "Hello World from main", Toast.LENGTH_SHORT);

this works fine. However, for every other activity in my application, I cannot display a Toast. No exception, nothing in the Log but I don't see the Toast.

My main activity starts another one with an options menu:

@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 which should display a Toast.

@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 could cause this issue? I am using the latest SDK with Min SDK Version = 3 and an 1.5 Emulator.

+4  A: 

I would say, classical error :
You forgot the Toast.show() method ;)

Sephy
Aaaaaarrrrrggggg, I am stupid. Thanks...
SchlaWiener
not stupid just absent-minded like me sometimes ;)
Sephy