N
Nuk3_Hive
Neues Mitglied
- 0
Hallo,
Ich Hab angefangen eine App zu programmieren und nun beim ersten start kommt immer eine Fehlermeldung ("Speech To Text" wurde beendet.) Meine Frage wodran liegt das?
Hier die MainActvity:
Der ADB log:
Die .xml Datein sind alle Richtig
Wenn ihr noch eine Information braucht bitte bescheid sagen
Vielen Dank im eure für ihre Hilfe
mfg Sascha
Ich Hab angefangen eine App zu programmieren und nun beim ersten start kommt immer eine Fehlermeldung ("Speech To Text" wurde beendet.) Meine Frage wodran liegt das?
Hier die MainActvity:
Code:
package com.example.sascha.projektschule;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.view.Menu;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Locale;
@SuppressWarnings("ConstantConditions")
public class MainActivity extends Activity {
public TextView txtSpeechInput;
public ImageButton btnSpeak;
public final int REQ_CODE_SPEECH_INPUT = 100;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtSpeechInput = (TextView) findViewById(R.id.txtSpeechInput);
btnSpeak = (ImageButton) findViewById(R.id.btnSpeak);
// hide the action bar
getActionBar().hide();
btnSpeak.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
promptSpeechInput();
}
});
}
/**
* Showing google speech input dialog
* */
private void promptSpeechInput() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
getString(R.string.speech_prompt));
try {
startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
} catch (ActivityNotFoundException a) {
Toast.makeText(getApplicationContext(),
getString(R.string.speech_not_supported),
Toast.LENGTH_SHORT).show();
}
}
/**
* Receiving speech input
* */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQ_CODE_SPEECH_INPUT: {
if (resultCode == RESULT_OK && null != data) {
ArrayList<String> result = data
.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
txtSpeechInput.setText(result.get(0));
}
break;
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
}
Der ADB log:
Code:
PropertyFetcher: AdbCommandRejectedException getting properties for device 00ecbdde: device offline
PropertyFetcher: AdbCommandRejectedException getting properties for device 00ecbdde: device unauthorized. Please check the confirmation dialog on your device.
PropertyFetcher: AdbCommandRejectedException getting properties for device 00ecbdde: device unauthorized. Please check the confirmation dialog on your device.
PropertyFetcher: AdbCommandRejectedException getting properties for device 00ecbdde: device unauthorized. Please check the confirmation dialog on your device.
DeviceMonitor: ExecutionException getting info for device 00ecbdde
ddmlib: Eine bestehende Verbindung wurde softwaregesteuert
durch den Hostcomputer abgebrochen
java.io.IOException: Eine bestehende Verbindung wurde softwaregesteuert
durch den Hostcomputer abgebrochen
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:65)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
at com.android.ddmlib.Client.sendAndConsume(Client.java:675)
at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:342)
at com.android.ddmlib.Client.requestAllocationStatus(Client.java:521)
at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:847)
at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:815)
at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:775)
at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:664)
at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:46)
at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:592)
Die .xml Datein sind alle Richtig
Wenn ihr noch eine Information braucht bitte bescheid sagen
Vielen Dank im eure für ihre Hilfe
mfg Sascha