How do you to implement Android 4.0 Restful, HTTP post request -
Since we have changed the way HTTP requests are made in the latest Android SDK, I know that a tutorial can not be found. How to request an HTTP post, especially for login, so I would like to see some code examples showing how an HTTP post request is implemented, and related to cookies. And if possible, I would like to see an example of a code for thanking you.
Library used:
Private onclicklists login = new onclick Leastner () {click on Public Zero (see View) {AsyncHttpClient myClient = new asyncHttpClient (); MyClient.get (URL, empty); MyClient.setCookieStore (myCookieStore); MyClient.setCookieStore (myCookieStore); String user name = ""; String password = ""; Request Parameters 1 = New RequestOf (); Params1.put ("username", user name); Params1.put ("password", password); Pd = ProgressDialog.show (this, "", "signing in ..."); MyClient.post (url, params1, new asyncHttpResponseHandler) {@Override Public Zero onSuccess (string response) {println ("response" + response); pd.dismiss (); if (response.contains ("k < - authorized -> gt;)} {} other {pd.dismiss (); references mContext = SigninActivity.This; not matchmag = new dialog (mContext); not matchmag .contentview (R.Letter loginfileDialoglyout); NoMachiodog SetTitle ("Log in unsuccessful"); DismissDialBatten = (buttons) notMatchDialog.findViewById (R.id.dismissDialogButton); Dismissed DialogButton.setOnClickListener (Dismiss Dia Log); notMatchDialog.show ();}} @Trusting public void on failure (throwable e, string response) {// TODO different failures need to detect and try to help the user.}}); }};
Comments
Post a Comment