I need the MainActivity-object as context in a Fragment-object.
Passing MainActivity as 'this' to a custom constructor of a Fragment-class works only when starting up the app. When rotating it calls the standard, null-argument-constructor via
super.onCreate(savedInstanceState);
Creating a new instance of MainActivity in Fragment does not work either. E.g:
MainActivity ma = new MainActivity(); AdapterTasks at = new AdapterTasks(ma,title, subt, imgid);
-->System services not available to Activities before onCreate()
How can I get a reference from the MainActivity object to a Fragment-object??