android - PhoneStateListener is not working when inherited from another class -
i trying inherit function class. includes registering phonestatelistener. following function try inherit in main.java.
public main(context context) { this.mcontext = context; } @override protected void oncreate(bundle savedinstancestate) { ... registerphonestatelistener(); } public void registerphonestatelistener() { myphonestatelistener = new myphonestatelistener(); telephonymanager = (telephonymanager) mcontext .getsystemservice(context.telephony_service); telephonymanager.listen(myphonestatelistener, phonestatelistener.listen_call_state); }
myphonestatelistener public class in main.java
public class myphonestatelistener extends phonestatelistener {...}
here coding in class.
main main =new main(this); main.registerphonestatelistener();
the phonestatelistener works fine in main.java, not working in class. please help, thank you!
in opinion there's difference. if run activity setup right things make activity working propertly. if make activity using new isnt same thing.
Comments
Post a Comment