android - app not working -


I have written a simple app that will tell the user any incoming message. Both programs when I does not seem to them are two different PGMs as lauched seem to fully work, but they are seen only speaker program screen to keep the same project / package and receiver PGM. If someone can help me out on that, please

the speaker is PGM:

  package com.example.TextSpeaker; Import java.util.Locale; Import android App Import android.content.Intent; Importroid.os.Bundle; Import android.speech.tts.TextToSpeech; Import android.speech.tts.TextToSpeech.OnInitListener; Import android.view.View; Import android.view.View.OnClickListener; Import android.widget.Button; Import android.widget.Toast; // The following program msg user speech converts public class uses TextSpeaker activity OnInitListener {/ ** Called when the activity went previously created * / Full MY_DATA_CHECK_CODE = 0; Public TextToSpeech MTTs; Public button button; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); SetContentView (R.layout.main); Button = (button) Find VVBIID (RID button); button.setOnClickListener (New OnClickListener () {See @Override public void onClick (v) {Toast.makeText (getApplicationContext (), "service has started \ N every new message will now read out" Toast.LENGTH_LONG). show ();}}); Intent myintent = new intent (); Myintent.setAction (TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); StartActivityForResult (myintent, MY_DATA_CHECK_CODE); } Void OnActivityResult (integer requestcode, integer resultcode, intent data) to protect {if (requestcode == MY_DATA_CHECK_CODE) {(resultcode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) If {// success (TTS engine mtts = new TextToSpeech it , this); Mtts.setLanguage (Locale.ENGLISH); } Else {// Install Engine Intent = New Intent (); Install.setAction (TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); StartActivity (installed); }}} Dustroy (bundle saved instantstabundle) at public zero {mtts.shutdown (); } Pause public at zero () {super.onPause (); // If there is no focus in our app (mtts! = Null) mtts.stop (); } @ Override int (int status) {if (status == TextToSpeech.SUCCESS) button on public zero .Cet enabled (true); }}  

and the recipient program is:

  package com.example.TextSpeaker; Import android.content.BroadcastReceiver; Import android.content.Context; Import android.content.Intent; Importroid.os.Bundle; Import android.speech.tts.TextToSpeech; Import android.telephony.SmsMessage; // Supports both GSM and CDMA import for android. Widget.Toast; Public class receiver extends BroadcastReceiver {@Override public void onReceive (Context context, Intent intent) {Bundle bundle = intent.getExtras (); SMS Message [] msgs = Null; String str = ""; If (! Bundle = null) {// Recover SMS received object [] PDUs = ([] object) bundle.get ("PDUs"); Msgs = New SMS Message [pdus.length]; For (int i = 0; i  

}

I think the TSP .mtts void you are creating a new instance of properly TextSpeaker by the OS, so there is no reason for the onCreate < / Code> method will be called, so


Comments