I have the following code in a form's submit button onClickListener:
String action, user, pwd, user_field, pwd_field;
action = "theURL";
user_field = "id";
pwd_field = "pw";
user = "username";
pwd = "password!!";
List<NameValuePair> myList = new ArrayList<NameValuePair>();
myList.add(new BasicNameValuePair(user_field, user));
myList.add(new BasicNameValuePair(pwd_field, pwd));
HttpParams params = new BasicHttpParams();
HttpClient client = new DefaultHttpClient(params);
HttpPost post = new HttpPost(action);
HttpResponse end = null;
String endResult = null;
try {
post.setEntity(new UrlEncodedFormEntity(myList));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
HttpResponse response = client.execute(post);
end = response;
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BasicResponseHandler myHandler = new BasicResponseHandler();
try {
endResult = myHandler.handleResponse(end);
} catch (HttpResponseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
How can I take the resulting string (endResult) and start a new activity using an intent that will open webview and load the html?