Okay so i had the problem of network usage in UI Thread and now using AsyncTask. I am using Fragments and have a problem.
When putting this line:
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
I have to add getActivity() because its in a fragmetn, then the error goes away but then i get an error on this line:
new DownloadWebpageTask().execute(stringUrl);
The error is: "No enclosing instance of type MainActivity is accessible. Must qualify the allocation with an enclosing instance of type MainActivity (e.g. x.new A() where x is an instance of MainActivity)."
Any ideas on how to fix this?