Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Mashape Android Async example
public void sendMessage(View view) {
EditText editText = (EditText) findViewById(;
String message = editText.getText().toString();
new CallMashapeAsync().execute(message);
private class CallMashapeAsync extends AsyncTask<String, Integer, MashapeResponse<JSONObject>> {
protected MashapeResponse<JSONObject> doInBackground(String... msg) {
QuestionAnswering client = new QuestionAnswering("MASHAPE_KEY");
return client.answerAQuestion(msg[0]);
protected void onProgressUpdate(Integer...integers) {
protected void onPostExecute(MashapeResponse<JSONObject> response) {
String answer = response.getBody().toString();
TextView txtView = (TextView) findViewById(;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.