Error trying to launch service from non-activity class

I previously had a Foreground service that I launched from one activity. The code to launch the service was contained within said activity. Now I would like to launch this service with a non-activity …

Pass Context or make use of view.getContext(). Does it really matter?

So, I have two options to get the context. See the following two methods (cleaned up for clarity) from a Utility Class. public static void onCopyClicked(Context context, ImageView copy){ copy….

Retrieve Context from a fragment

I created a class to retrieve comments from a JSON encoding from a PHP file. This class, extends from AsyncTask: public class RecuperarComentarisFoto extends AsyncTask{ …