So I'm attempting to connect to the Tumblr Dashboard using an HTTP
Post. The Activity uses a WebView and I do an http post after creating
the webview, but the redirect_to in the HTTP Post doesn't work with
the WebView. I know my post works and isn't throwing errors, however I
need the HTTP Post to work with the webview and am completely lost on
how to.
private void setupWebView() {
webView = new WebView(this);
setContentView(webView);
webView.setWebViewClient(new OverriddenWebClient());
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setJavaScriptEnabled(true);
loginTumblrDashboard.start();
webView.loadUrl("http://www.tumblr.com/iphone");
}
private Thread loginTumblrDashboard = new Thread(){
public void run(){
// Create a new HttpClient and Post Header
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new
HttpPost("http://www.tumblr.com/login");
try{
//add the needed strings to and ArrayList for
posting to tumblr
List<NameValuePair> tumblr = new
ArrayList<NameValuePair>(3);
tumblr.add(new BasicNameValuePair
("email","[email protected]"));
tumblr.add(new
BasicNameValuePair("password","sh1n0b1"));
tumblr.add(new
BasicNameValuePair("redirect_to","/iphone"));
//set the HtppPost entity
httpPost.setEntity(new
UrlEncodedFormEntity(tumblr));
//execute the post
HttpResponse mResponse =
httpClient.execute(httpPost);
}
catch(Exception e){
e.printStackTrace();
}
}
};
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---