Nullpointerexception getSystemService

Posted by moppel on Stack Overflow See other posts from Stack Overflow or by moppel
Published on 2010-05-21T15:43:51Z Indexed on 2010/05/22 13:10 UTC
Read the original article Hit count: 163

Filed under:

Following line will only not result in a nullpointer exception if I'm connected to a WLAN:

ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

Otherwise I get a nullpointer-exception straight ahead? How can I fix this? I want my background service to only work, when it is connected to wlan. But that Nullpointerexception just kills the whole app...

© Stack Overflow or respective owner

Related posts about android