Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Sample code on how to use Unirest-java to call Mashape APIs in your Android projects
public void sendMessage(View view) {
EditText editText = (EditText) findViewById(;
String message = editText.getText().toString();
TextView txtView = (TextView) findViewById(;
new CallMashapeAsync().execute(message);
private class CallMashapeAsync extends AsyncTask<String, Integer, HttpResponse<JsonNode>> {
protected HttpResponse<JsonNode> doInBackground(String... msg) {
HttpResponse<JsonNode> request = null;
try {
request = Unirest.get("" + msg[0] + "&answerLookup=true&answerSearch=true")
.header("X-Mashape-Authorization", "<Insert your Mashape key here>")
} catch (UnirestException e) {
// TODO Auto-generated catch block
return request;
protected void onProgressUpdate(Integer...integers) {
protected void onPostExecute(HttpResponse<JsonNode> response) {
String answer = response.getBody().toString();
TextView txtView = (TextView) findViewById(;

I am getting NoClassDefFoundError: Failed resolution of: Ljavax/naming/ldap/LdapName;. Can you please help me to resolve this issue.

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.