I'm trying to set up PhoneStateListener
but I get a PhoneCallListener cannot be resolved to a type
.
public class ButtonView extends FrameLayout {
PhoneCallListener phoneListener = new PhoneCallListener();
TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.listen(phoneListener,PhoneStateListener.LISTEN_CALL_STATE);
}
In another Example, I found its written like this and it's working
public class MainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
// add PhoneStateListener
PhoneCallListener phoneListener = new PhoneCallListener();
TelephonyManager telephonyManager = (TelephonyManager) this
.getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.listen(phoneListener,PhoneStateListener.LISTEN_CALL_STATE);
}
What should I change in my code to make it working?