As Bnet above, i'm trying to write a program whichs detects the different states of the phone and mke a different noise in each case. There is a problem that i really don't understand!!!!! Please someone can take a look at it and try to explain to ma what's wrong ?
public class testsonqdappel extends Activity { private TelephonyManager telephone; private MediaPlayer audio; public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); telephone = (TelephonyManager)getSystemService (Context.TELEPHONY_SERVICE); } private PhoneStateListener psl = new PhoneStateListener() { @Override public void onCallStateChanged (int state, String incomingNumber) { state = telephone.getCallState(); if(state == android.telephony.TelephonyManager.CALL_STATE_IDLE) { audio = MediaPlayer.create(getBaseContext(), R.raw.bonjour); audio.start(); } if (state == android.telephony.TelephonyManager.CALL_STATE_RINGING) { audio = MediaPlayer.create(getBaseContext(), R.raw.batterie); audio.start(); } if (state == android.telephony.TelephonyManager.CALL_STATE_OFFHOOK) { audio = MediaPlayer.create(getBaseContext(), R.raw.pleine); audio.start(); } } }; } Thanks a lot --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---