I have following code.but it couldn't produce output. myCode:
public class SpeakActivity extends Activity implements OnInitListener{ private TextToSpeech tts; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_speak); LocationManager locationManager; String context = Context.LOCATION_SERVICE; locationManager = (LocationManager)getSystemService(context); Criteria crta = new Criteria(); crta.setAccuracy(Criteria.ACCURACY_FINE); crta.setAltitudeRequired(false); crta.setBearingRequired(false); crta.setCostAllowed(true); crta.setPowerRequirement(Criteria.POWER_LOW); String provider = locationManager.getBestProvider(crta, true); // String provider = LocationManager.GPS_PROVIDER; Location location = locationManager.getLastKnownLocation(provider); tts = new TextToSpeech(this, this); updateWithNewLocation(location); } public void say(String text2say){ tts.speak(text2say, TextToSpeech.QUEUE_FLUSH, null); } @Override public void onInit(int status) { say("latLongString"); } @Override public void onDestroy() { if (tts!= null) { tts.stop(); tts.shutdown(); } super.onDestroy(); } private void updateWithNewLocation(Location location) { String latLongString; TextView myLocation; myLocation = (TextView) findViewById(R.id.myLocation); if(location!=null) { //tts=new TextToSpeech(this,this); double lat = location.getLatitude(); double lon = location.getLongitude(); latLongString = "Lat:" + lat + "\nLong:" + lon; // tts.speak(latLongString, RESULT_OK, null); }else{ latLongString="no location found"; } myLocation.setText("Your current position is:\n" + latLongString); say(latLongString); -- 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