How to properly setup an activation hook
You first example looks corrent. There is however a typo, hence class ‘MyPluginAdmin’ not found. You include myplugin-admin.php, but then your question seems to suggest the page holding the class is in fact my-plugin-admin.php (with a hypen). If I correct the typo and run the code there are no warnings. Edit (this works correctly): my-plugin.php: … Read more