2011-11-14 9 views
0

Hello Worldと言うと、このプログラムに単純なHello Worldメッセージが表示されるようにするにはどうすればよいですか?このプログラムをAndroidアプリケーション2.1以降を実行している携帯電話の画面に表示する音声認識アプリケーションにしたいと考えています。こんにちは、世界。音声認識

// **** SpeechRecognition.java ***** 
    package com.SpeechRecognition.CMPE4373; 

    import android.app.Activity; 
    import android.os.Bundle; 
    import android.widget.*; 
    import android.os.Handler; 

    import android.speech.*; 
    import android.inputmethodservice.*; 

    public class SpeechRecognition extends Activity { 
    /* Declaring variables */ 
    private static final String TAG = "VoiceRecognition"; 
    private static final int VOICE_RECOGNITION_REQUEST_CODE = 1234; 
    private ListView mList; 
    private Handler mHandler; 
    private Spinner mSupportedLanguageView; 

    /** Called when the activity is first created. */ 
     @Override 
     public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     mHandler = new Handler(); 

     } 
     } 





<!--    layout/main.xml   --> 
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello" /> 

</LinearLayout> 




<!--    AndroidManifest.xml   --> 
<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.SpeechRecognition.CMPE4373" 

android:versionCode="1" 
android:versionName="1.0" > 
<uses-sdk android:minSdkVersion="14" /> 
<application 
    android:icon="@drawable/ic_launcher2" 
    android:label="@string/app_name" > 
    <activity 
     android:label="@string/app_name" 
     android:name=".SpeechRecognition" > 
     <intent-filter > 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    </application> 

</manifest> 

答えて

0

Thisは、あなたが探しているものを、正確である:

は、これまでのところ、これは私が持っているものです。 あなたは、Android-SDK

+0

あなたは、私が「Hello Worldのを表示するテキストフィールドを作成する必要がどのようなコードの行知っていますか"私は上記の同じコードを使用してマイクで話す? – user1046106

0

の内側にあなたのAPI-サンプルですでにそれを持っているか、これを試してみてください。

​​