Service vs IntentService in the Android platform

Tejas Lagvankar wrote a nice post about this subject. Below are some key differences between Service and IntentService. When to use? The Service can be used in tasks with no UI, but shouldn’t be too long. If you need to perform long tasks, you must use threads within Service. The IntentService can be used in long tasks usually with no communication … Read more

Warning: Do not place Android context classes in static fields; this is a memory leak (and also breaks Instant Run)

Just make sure you pass context.getApplicationContext() or call getApplicationContext() on any context that is passed in via methods/constructor to your singleton if you decide to store it in any member field. idiot proof example (even if someone would pass in an activity it will grab the app context and use that to instantiate the singleton): … Read more

Cannot resolve method getApplicationContext()

The trouble is that you are calling getApplicationContext() inside a Class that does not extend Context or its subclasses (Activity, etc). You should pass Context or its subclass to the JSONTask constructor. Furthermore, I don’t see where you are initializing lvMovies – and you are likely to get NullPointerException at lvMovies.setAdapter(adapter); – my suggestion is that you should pass this as well to your JSONTask constructor: so that in the onPostExecute you can … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)