Tring do skonfigurowania PhoneStateListener, ale otrzymuję komunikat "PhoneCallListener nie można rozwiązać na typ".Dodaj PhoneStateListener
public class ButtonView extends FrameLayout {
PhoneCallListener phoneListener = new PhoneCallListener();
TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.listen(phoneListener,PhoneStateListener.LISTEN_CALL_STATE);
}
W innym przykładzie, znalazłem jego napisane jak to i to działa
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);
}
Co muszę zmienić w moim kodu, aby to działa? Dzięki za pomoc
http://stackoverflow.com/questions/ 5345470/onclicklistener-nie można usunąć-do-typu-zaćmienia – Omarj