android - java.lang.InstantiationException: class has no zero argument constructor -
i trying use broadcastreceiver inner class track network state got exception in title. should fix problem?
public class networkchangereceiver extends broadcastreceiver { public networkchangereceiver() { } @override public void onreceive(context context, intent intent) { final connectivitymanager connmgr = (connectivitymanager) context .getsystemservice(context.connectivity_service); final android.net.networkinfo wifi = connmgr.getnetworkinfo(connectivitymanager.type_wifi); final android.net.networkinfo mobile = connmgr.getnetworkinfo(connectivitymanager.type_mobile); if (wifi.isavailable() || mobile.isavailable()) { setupdata(); log.d("netowk available ", "flag no 1"); } } }
your
inner broadcast receiver must static ( registered through manifest)
or
non-static broadcast receiver must registered , unregistered inside parent class
for this.
i using inner broadcast reciver, without registering within class. either make static , register in manifest , or make non static , register , unregister inside parent class .
Comments
Post a Comment