1. Check out our companion app, Forums for Android! Download from Google Play

Android 2.2 Voice Recognition Sample problem And Speech Recognition with file

Discussion in 'Application Development' started by bibinours, Aug 25, 2010.

  1. bibinours

    bibinours New Member
    Thread Starter
    5

    Aug 25, 2010
    1
    0
    5
    Hello,
    I'm using android emulator (SDK 2.2) with Eclipse and I tried to do
    work the sample VoiceRecognition.java but it returns to me this
    message "Recognizer not present". What's the matter? I read on
    different forums "a problem with the initial system image", should I
    upgrade system image or there is nothing to do with this?
    I have another problem, I would like to use an wav or mp3 like input
    of my speech recognizer (instead of audio record with microphone), how
    to do this? is it possible or not?

    Thank you.
     

    Advertisement

  2. vivekcr

    vivekcr New Member
    5

    Feb 3, 2011
    1
    0
    5
    Hi ther,
    im tryin to build an application based on voice recognition ,i downloaded the sample code from androiddevelopers.com but wasnt able to build it.
    Ther was some problem with the resources R.java etc, how come u managed to compile it pls help me out here.........................
    thank you
     
  3. shinmeiryu

    shinmeiryu New Member
    5

    Feb 16, 2011
    2
    0
    5
    The voicerecognizer needs an app to run it, in this case I used the Google Voice Search.


    @vivekcr
    you should adjust your main.xml in your res.layout
    like this:
    Code (Text):
    1.  
    2. [SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080][LEFT]<?[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]xml[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]version[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"1.0"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]encoding[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"utf-8"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]?>[/LEFT]
    3. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf][LEFT]<!--
    4. * Copyright (C) 2008 [U]Google[/U] Inc.
    5. *
    6. * Licensed under the [U]Apache[/U] License, Version 2.0 (the "License");
    7. * you may not use this file except in compliance with the License.
    8. * You may obtain a copy of the License at
    9. *
    10. * http://www.apache.org/licenses/LICENSE-2.0
    11. *
    12. * Unless required by applicable law or agreed to in writing, software
    13. * distributed under the License is distributed on an "AS IS" BASIS,
    14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15. * See the License for the specific language governing permissions and
    16. * limitations under the License.
    17. -->[/LEFT]
    18. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/LEFT]
    19. [/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf][LEFT]<!-- This activity displays UI for launching voice recognition -->[/LEFT]
    20. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/LEFT]
    21. [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080][LEFT]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]LinearLayout[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]xmlns:android[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http://schemas.android.com/apk/res/android"[/LEFT]
    22. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/LEFT]
    23. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/LEFT]
    24. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:orientation[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"vertical"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>[/LEFT]
    25. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
    26. [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]TextView[/LEFT]
    27. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/LEFT]
    28. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/LEFT]
    29. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:paddingBottom[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"4dip"[/LEFT]
    30. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:text[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Voice Commander"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/LEFT]
    31. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
    32. [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]Button[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/btn_speak"[/LEFT]
    33. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/LEFT]
    34. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/LEFT]
    35. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:text[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"speak"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/LEFT]
    36. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
    37. [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]<[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]ListView[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_width[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wrap_content"[/LEFT]
    38. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_height[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"0dip"[/LEFT]
    39. [/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:layout_weight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"1"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#7f007f][SIZE=2][COLOR=#7f007f]android:id[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]=[/SIZE][I][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"@+id/list"[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]/>[/LEFT]
    40. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/LEFT]
    41. [/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]</[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f7f][SIZE=2][COLOR=#3f7f7f]LinearLayout[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#008080][SIZE=2][COLOR=#008080]>
    42. [/COLOR][/SIZE][/COLOR][/SIZE]
    and also in your voicerecog class,
    Change
    "setContentView(R.layout.voice_recognition);"
    to
    "setContentView(R.layout.main);"

    this was the main reason why my voice recogn didnt work.
     
  4. sofia_fi

    sofia_fi New Member
    5

    May 3, 2011
    1
    0
    5
    i have the same problem,but the aplication used is an Android's sample. It
     

Share This Page

Loading...