Start the application by finishing previous talk

This commit is contained in:
Mathieu Maret 2016-01-20 17:47:11 +01:00
parent 86469b0d3d
commit 1dc5fc78f9

View File

@ -55,6 +55,7 @@ public class MainActivity extends Activity {
promptSpeechInput();
}
});
new SilentTalkToMeTask().execute("goodbye");
}
@ -130,6 +131,24 @@ public class MainActivity extends Activity {
protected void onPostExecute(String 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 {
InputStream is = null;
@ -172,7 +191,6 @@ public class MainActivity extends Activity {
reader.read(buffer);
return new String(buffer);
}
}
}