Toast unexpectedly not showing in plugin config activity

I don’t know Android app development very well.

I currently trying to create a configuration UI for a plugin, referreing to this guide.

Then I encountered a strange problem: toast.show() didn’t seem to work inside onInitializePluginOptions() or onCreate() - unless I then tried to declare the config activity as the launcher activity, with following lines in AndroidManifest.xml:

        <activity
            android:name=".ConfigActivity">
...
            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER"/>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>

Other toast.show() calls, like inside AlertDialog's OnDismissListener, didn’t seem to have this problem - the toast popped up as usual.

I’ve discovered a workaround for this problem (without declaring the config activity as launcher activity), but I have no idea why it can work (on my device), let alone whether it will work on other devices.

    private Toast toast;
    private Handler handler;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
...
        this.toast = Toast.makeText(this, "", Toast.LENGTH_LONG);
        this.handler = new Handler(); // workaround toast unexpectedly not showing problem
...
    }
...
    @Override
    protected void onInitializePluginOptions(@NonNull PluginOptions pluginOptions) {
...
        // toast.show(); // unexpectedly not shown. workaround below
        handler.post(new Runnable() {
            @Override
            public void run() {
                toast.show();
            }
        });
...
    }