How to get token from server BrainTree <p>How do I get the token from my server? I went the tedious process of simply getting the token to appear on my server but now I don't know how to pull it down and use it in my Android app. This is the method that Braintree suggested and it had a boat load of errors when I copied and pasted it. I managed to get past them but I had to implement a few methods that I don't think are right. </p> <p>All I need to be able to do is get the client token and use as a variable in my app. Someone please help. P.S. I'm really new at Android dev. </p> <pre><code>import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import com.loopj.android.http.*; import com.braintreepayments.api.dropin.BraintreePaymentActivity; import org.apache.http.Header; public class MainActivity extends ActionBarActivity { private int REQUEST_CODE; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } AsyncHttpClient client = new AsyncHttpClient(); public void fetchClientToken() { client.get("http://clomes.com/clomes/braintree/customer/gettoken", new TextHttpResponseHandler() { public String clientToken; @Override public void onFailure(int i, Header[] headers, String s, Throwable throwable) { } @Override public void onSuccess(int i, Header[] headers, String clientToken) { this.clientToken = clientToken; } }); } @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; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } </code></pre>