title: How to listen to change in internet connection in my Android app?
body: <p>I already created an android app which uses a web service to send and retrieve JSON data.</p>
  
  <p>When I make a request while the device is online it works fine but when the device goes offline the app is stuck and prints Null Pointer Exception error.</p>
  
  <p>Is there a way to listen to the internet connection?</p>