Hi Brandall,
This is just a quick off-the-cuff reply, as it's a manic time at work.
AndroidTwitterLogin needs control of the UI, so I don't think you can async it.
Happy to be proved wrong!
But once you've got authorisation tokens from it, you can save them & reuse them forever.
Here's an example of using AndroidTwitterLogin:
final AndroidTwitterLogin atl = new AndroidTwitterLogin(app,
TWITTER_KEY,TWITTER_SECRET,CALLBACK) {
@Override
protected void onSuccess(Twitter jtwitter, String[] tokens) {
// Save the tokens in your app for future use!
// Do stuff now if you like, e.g.
jtwitter.setStatus("Hello World");
}
protected void onFail(Exception e) {
// oh well
}
};
// Now make your "authorise twitter" button
myButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
myButton.setEnabled(false);
// Let's add a tiny pause to let myButton update to look disabled
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
atl.run();
}
},5);
}
});
I hope that helps.
Best regards,
- Daniel