小编use*_*687的帖子

没有Google对话框的语音识别

我将尝试在没有带有RecognitionListener的Google对话框的情况下使用语音识别,但在启动应用程序时只能发出蜂鸣声.我已将权限音频记录和互联网添加到清单文件中.我希望你告诉我并帮我找错...我在Log cat上没有错误...我想在用户说出问候时向一个循环显示一个消息进行循环Regognition OK并且列表视图显示结果.

 public  class MainActivity extends Activity  implements RecognitionListener
{

 private ListView wordsList;

private SpeechRecognizer mSpeechRecognizer;
private Intent mSpeechRecognizerIntent; 


protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(this);
    mSpeechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                                     RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
                                     this.getPackageName());

    wordsList = (ListView) findViewById(R.id.listView1); 

    mSpeechRecognizer.startListening(mSpeechRecognizerIntent);

}


    public void onBeginningOfSpeech(){ }

        public void onBufferReceived(byte[] buffer){ }

        public void onEndOfSpeech(){ }

        public void onError(int error){

           //mSpeechRecognizer.startListening(mSpeechRecognizerIntent);

    }

    public void onEvent(int eventType, Bundle params){ }


    public void onPartialResults(Bundle partialResults){ }


    public void onReadyForSpeech(Bundle params){


        Toast.makeText(getBaseContext(), …
Run Code Online (Sandbox Code Playgroud)

android speech voice-recognition

7
推荐指数
2
解决办法
1万
查看次数

如何检查android设备是否支持库?

我创建了一个带有IR Blaster的Android应用程序,我希望我的代码能够检查Android设备是否支持这些库.当另一台设备安装我的应用程序时,它会崩溃.我怎么能避免这个?

我希望我的代码能够获取有关手机是否支持我的应用的信息.

java android classloader

2
推荐指数
1
解决办法
1602
查看次数

我可以在Android布局中添加几个广告横幅?

我想在LinearLayout中添加第二个广告横幅,但是插入第二个横幅时我的应用程序崩溃。将外部横幅插入RelativeLayout效果很好,但是我想在ScrollView内添加第二个。我该怎么办?这是我的代码:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000" > 

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

          <TextView

          />

          <ToggleButton

          />

    <com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"

    ads:adSize="BANNER"
    ads:adUnitId="xxxxxxxx"
    ads:loadAdOnCreate="true"
     >
</com.google.ads.AdView>

 </LinearLayout>
  </ScrollView>

 <com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="xxxxxxxxx"
    ads:loadAdOnCreate="true"
     >
</com.google.ads.AdView>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

android ads banner admob android-linearlayout

1
推荐指数
1
解决办法
3239
查看次数