Voice Notifications

This is a discussion on Voice Notifications within the Beginning Developers forums, part of the Android Development category; Hello, I would like to make a notification both available on the screen and by a voice message. I was reading some tutorial and tried ...

Results 1 to 2 of 2

Thread: Voice Notifications

  1. #1
    Android Lurker buzza's Avatar
    Join Date
    Sep 2012
    Posts
    1

    Voice Notifications

    Hello, I would like to make a notification both available on the screen and by a voice message.
    I was reading some tutorial and tried to make it work, but really got stacked

    I have 2 classes: one gets location information and sends it to the server; second - voice class to implement voice alerting.

    Voice.java looks like this:
    Code:
    import java.util.Locale;
    import android.app.Activity;
    import android.speech.tts.TextToSpeech;
    import android.util.Log;
    import android.os.Bundle;
    
    publicclass Voice extends Activity implements
    TextToSpeech.OnInitListener {
    //Called when the activity is first created
    private TextToSpeech tts;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    tts = new TextToSpeech(this, this);
    
    }
    @Override
    public void onDestroy() {
    // shutdown tts
    if (tts != null) {
        tts.stop();
        tts.shutdown();
    }
    super.onDestroy();
    }
    
    
    @Override
    public void onInit(int status) {
    // TODO Auto-generated method stub
    
    }
    
    
    public void speakOut(String text) {
    
    
    tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
    }
    }
    When I am trying to access speakOut from my first class:
    Code:
    String waitingtext = "Waiting for location";
    Voice.speakOut(waitingtext);
    But it looks like I am doing something completely wrong. Eclipse says that I have to change speakOut to a static method…

    What I am thinking about is that I want to create a class that will manage my voice notifications (not only this one, but any other alerts/errors that occur: they should be logged, showed on the screen and made as a voice announcement).

  2. Android.net is the premier Android Forum. Registered users do not see these ads. .

  3. #2
    Super Moderator cali's Avatar
    Join Date
    Sep 2011
    Posts
    4,830
    Thanked
    329 times
    Want to welcome you to the site.

Remove Ads

http://www.scramblerducati.org/

Sponsored Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. Notifications
    By Karenn.x in forum Samsung Galaxy S3
    Replies: 2
    Last Post: 09-20-2012, 07:44 PM
  2. Replies: 0
    Last Post: 06-21-2012, 04:58 PM
  3. Uninstalling Voice Data Required for Voice Synthesis..
    By upkarxxx in forum Sony Xperia Neo
    Replies: 0
    Last Post: 05-19-2012, 04:48 AM
  4. NOTIFICATIONS
    By JABZOO in forum LG Ally Help
    Replies: 1
    Last Post: 10-12-2010, 12:45 PM

Search tags for this page

android tts notifications
,

android voice notification

,
android voice notifications
,
peakout
,
voice notify android app
,

voice notify android tutorial

Click on a term to search our sites for related topics.
Android Forum