I am trying to generate the DTMF tones but facing an error all time as
"Application has stopped unexpectedly. Please try again", as i run the
application. I search a lot but couldn't get rid of it. Pleas Please
help me out.
The code is as follows :
package com.srb.basics;
import android.app.Activity;
import android.media.AudioManager;
import android.media.ToneGenerator;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import static android.media.ToneGenerator.TONE_DTMF_1;
public class myMain extends Activity {
ToneGenerator tone;
Button buttonTone;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
int a = AudioManager.STREAM_DTMF;
tone = new ToneGenerator(a,100);
buttonTone = (Button) findViewById(R.id.Tutorial);
buttonTone.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
tone.startTone(TONE_DTMF_1, 2000);
}
});
}
}
Thanks a lot in advance.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en