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 7667217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:02:41+00:00 2026-05-31T15:02:41+00:00

I am developing speech recognition for Java Application Using Sphinx 4. I want speech

  • 0

I am developing speech recognition for Java Application Using Sphinx 4. I want speech recognition for ANDroid. Please Help Me 🙂

  • 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-05-31T15:02:42+00:00Added an answer on May 31, 2026 at 3:02 pm
        //declearation
     private static final int VOICE_RECOGNITION_REQUEST_CODE = 1234;
    
        TextToSpeech talker;
    
    
    //onCreate
     Button speakButton=new Button(this);
    
    
             talker = new TextToSpeech(this, this);
    // Check to see if a recognition activity is present
            PackageManager pm = getPackageManager();
            List<ResolveInfo> activities = pm.queryIntentActivities(
                    new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
            if (activities.size() != 0) {
                speakButton.setOnClickListener(new OnClickListener() {
    
                    public void onClick(View v) {
                        // TODO Auto-generated method stub
                         startVoiceRecognitionActivity();
                    }
                });
            } else {
                speakButton.setEnabled(false);
                speakButton.setText("Recognizer not present");
            }
    
    //methods
    
    /**
         * Fire an intent to start the speech recognition activity.
         */
        private void startVoiceRecognitionActivity() {
            Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                    RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
            intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo");
            startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
    
    
        }
    
     /**
         * Handle the results from the recognition activity.
         */
    
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) {
    
                ArrayList<String> matches = data.getStringArrayListExtra(
                        RecognizerIntent.EXTRA_RESULTS);
    
    
            String device = "Bedroom";
    
                String host = "http://web2.anzleads.com/Android/nimboPani/web-service.php?tmote=";
                String userCommand = URLEncoder.encode(matches.get(0));
                String deviceSelected = "&org=" + device;
               res =  getServerResponse(host + userCommand + deviceSelected);
               say(""+ res);
    
    
    
            }
    
            super.onActivityResult(requestCode, resultCode, data);
        }
    
    
        public void say(String text2say){
                      talker.speak(text2say, TextToSpeech.QUEUE_FLUSH, null);
                    }
    
    
        public void onInit(int status) {
            // TODO Auto-generated method stub
        //  say("Hello World");
        }
    
    
               public void onDestroy() {
              if (talker != null) {
                     talker.stop();
                     talker.shutdown();
                  }
    
                  super.onDestroy();
               }
    
     public String getServerResponse(String url)
        {
            String result = "";
            HttpClient hc = new DefaultHttpClient();
            HttpResponse hr ;
            HttpGet hg = new HttpGet(url);
            try
            {
                hr = hc.execute(hg);
                if(hr.getStatusLine().getStatusCode() == 200)
                {
                    HttpEntity he = hr.getEntity();
                    if (he != null)
                    {
                        InputStream is = he.getContent();
                          result = convertStreamToString(is);
                          is.close();
    
                    }
                }
            }
    
    
    
            catch (Exception e) {
                // TODO: handle exception
            }
    
             return result;
    
        }
    
    
        private String convertStreamToString(InputStream instream) {
            BufferedReader reader = new BufferedReader(new InputStreamReader(instream));
            StringBuilder sb = new StringBuilder();
    
    
            String line = null;
            try {
                while ((line = reader.readLine()) != null) {
                    sb.append(line + "\n");
                }
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                try {
                    instream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
    
            return sb.toString();
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing an application for Android, i want to record data that will be usefull
I am developing an android application in which there is some speech to the
im developing windows application using c#. i want to close the application and show
I'm developing the blackberry app, and in that I want to implement TTS (Text-to-Speech)
Currently developing an application using the newest version of symfony, obtained through PEAR. This
Developing a desktop application based on Java + Swing I faced the problem of
Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.
Developing an application using SWT to work in both Linux and Windows. I created
I am developing a speech dictation app in android that send the recorded audio
I am playing with using TTS built into .NET 4 and want the speech

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.