Start the application by finishing previous talk
This commit is contained in:
parent
86469b0d3d
commit
1dc5fc78f9
@ -55,6 +55,7 @@ public class MainActivity extends Activity {
|
|||||||
promptSpeechInput();
|
promptSpeechInput();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
new SilentTalkToMeTask().execute("goodbye");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +131,24 @@ public class MainActivity extends Activity {
|
|||||||
protected void onPostExecute(String s) {
|
protected void onPostExecute(String s) {
|
||||||
txtSpeechInput.setText(s);
|
txtSpeechInput.setText(s);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SilentTalkToMeTask extends AsyncTask<String,Void, String>{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(String... question) {
|
||||||
|
try {
|
||||||
|
return talkToServer(question[0]);
|
||||||
|
} catch (IOException e){
|
||||||
|
Log.d(TAG, "Coincoin "+e);
|
||||||
|
return "Cannot connect to server";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String s) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String talkToServer(String question) throws IOException {
|
private String talkToServer(String question) throws IOException {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
@ -172,7 +191,6 @@ public class MainActivity extends Activity {
|
|||||||
reader.read(buffer);
|
reader.read(buffer);
|
||||||
return new String(buffer);
|
return new String(buffer);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user