Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8374929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:02:46+00:00 2026-06-09T15:02:46+00:00

I want to convert my current latitude,longitude text into speech.I have code for finding

  • 0

I want to convert my current latitude,longitude text into speech.I have code for finding current latitude,longitude.But i initialize the TextToSpeech method inside Location class i got only latLongString.I couldn’t get EX:your current location is lat=1.222,long=22.335.

Here my Code:

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 speak(String text2say){

             tts.speak(text2say, TextToSpeech.QUEUE_FLUSH, null);

          }

    @Override

       public void onInit(int status) {


          say("latLongString");    

       }






    private void updateWithNewLocation(Location location) { 
        String latLongString;
        TextView myLocation; 
        myLocation= (TextView) findViewById(R.id.myLocation);



        if(location!=null) { 

        double lat = location.getLatitude(); 
        double lon = location.getLongitude(); 
        latLongString = "Lat:" + lat + "\nLong:" + lon;     

        }else{

            latLongString="no location found";
        }
        myLocation.setText("Your current position is:\n" + latLongString);

        speak(latLongString);

    }




    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_speak, menu);
        return true;
    }

@Override

public void onDestroy() {

   if (tts!= null) {

      tts.stop();

      tts.shutdown();

   }   

   super.onDestroy();

}}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:02:48+00:00Added an answer on June 9, 2026 at 3:02 pm

    Pass your lat long string into text in speakOut() as in example given by spk. And call this function to get speak.

    private void speakOut() {
    
            String text = txtText.getText().toString();
    
            tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to convert mouse's current X and Y coordinates into the 3D space
I want to convert NSString to NSDate but UIPickerView shows current datedatePicker=[[UIDatePicker alloc]init]; datePicker.userInteractionEnabled=YES;
In my current project, I want to convert List<String> to RegionLabel Object. For instance,
I want to convert a string to formatted text in C# in WPF application,
I want to convert a column of numbers to numeric, but there are certain
I want to convert plaintext to link for an input I have. The HTML
I want to convert XML into binary data in Java? What is the fastest
I have a string like def data = session=234567893egshdjchasd&userId=12345673456&timeOut=1800000 I want to convert it
I solved a problem recently. But I have this one piece of code where
in my php5 code i want to use the UNIX_TIMESTAMP function to convert a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.