How to implement Listner for particular task?
<p>I am new to android.</p>

<p>I am implementing one app related to network .</p>

<p>Regarding my app</p>

<p>I am checking the network sate</p>

<pre><code>private void isNetworkAvailable(Context con) {       
   ConnectivityManager connectivity = (ConnectivityManager) con.getSystemService(Context.CONNECTIVITY_SERVICE);        
   networkstate = connectivity.getActiveNetworkInfo().isConnected();    
}


if(net work is available) {
    // execute
}
else // if network is not available
{
   // here i want to create a listener for checking for net work state every time.
}
</code></pre>

<p>If any one know the solution please help me.</p>

<p>Thanks in advance.</p>
