android - Can anyone help for getting response by entering username and password? -


I click on I have fulfilled all the assumptions of username and password but I do not know how I can use JSON RESTFUL in this code. So plz helps me solve this problem.

  import android.app.activity; Importroid.os.Bundle; Import android.widget.Button; Import android.widget.EditText; Public classroom increases main activity activity {Private Static Last String SERVICE_URI = "http://www.safepestadmin.com.au/windex.php?itfpage=login"; Public editing text, edittext_username, edittext_password; Button button_submit; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); SetContentView (R.layout.activity_main); Edittext_password = (edit text) findViewById (R.id.login_edittext_password); Find Edittext_username = (EditText) ViewById (R.id.login_edittext_username); Button_submit = (button) FindById (R.id.login_button_submit); Button_submit.setOnClickListener (New OnClickListener) {@Override Public Zero Click on (see ARG0) {// TODO auto generated method stub string email = edittext_username.getText (). ToString () Trim (); String Emailpartn = "[a -zA-Z0-9 ._-] + @ [az] + \\. + [Az] +"; String pwd = edit_password.gate text (). ToString (); If (email.matches ("") & amp; amp; pwd.matches ("")) {Toast.makeText (getApplicationContext), "Please enter username and password", toast. LNNGHHORT). Show ();} and if (Email matches (EmailParton) & amp; Amp; pwd.matches ("")) {Toast.makeText (getApplicationContext), "Please enter a password", toast .LENGTH_SHORT). Show ();} and if (email.matches ("") & amp; amp; pwd.length ()> gt; {toast.makeText (getApplicationContext), "Please enter a username", toast .LENGTH_SHORT). Show ();} and if (email matches (emailpartan) & amp; amp; pwd .length ()> gt; {toast .com, "invalid email address", toast.LnGHIORT). Show ();} and (! Email matches (email pattern) & amp; P; Pwd.matches ("")) {Toast.makeText (getApplicationContext), "Please enter a password", Toast.LnnGHIHTT). Show (); } And if (email.matches ("alam@gmail.com") & amp; amp; amp; and pwd.matches ("12345") {Toast. GetApplicationContext, "successfully logged in" , Toast. LNNHHLL). (); } Else {toast.makeText (getApplicationContext ()), "Please enter registered email and password", toast. LNNHH_LOG). Show (); }}}); }}    

You can try:

    < li>
  • Keep the password in your server as an encrypted password in your database
  • When the user name and password are on the website, you can get the user password and Compare it with the password coming from DCPit and Customer
  • I match the password, if you can send the wrong, you can Only send true to the customer
  • If it comes from true in the client Customer can allow you to enter

    Client code:

    You can create a square like this:
      Public class web_api_get asyncTask and object, object, string & gt; {@ Override Public String Iain Background (Object ... Parameters) {StringBillilder Builder = New StringBuilder (); HTTP Parameters Parameters 2 = new basic HTTPPARM (); HTTP protocols. Setwarson (Parameters 2, http version.ttp_1_1); HTC Protocolperms. Stuttgart Charset (Paramus 2, "UTF-8"); Params2.setBooleanParameter ("http.protocol.expect-continue", Incorrect); HTTP Client Client = New DefaultHttpClient (Parameters 2); HttpGet httpGet = new HTTP gate (parameter [0] + ""); Try {HttpResponse response = client.execute (httpGet); Threaded Positions = Response .getStatusLine (); Int statusCode = statusLine.getStatusCode (); If (statusCode == 200) {HttpEntity entity = response.getEntity (); InputStream content = entity.getContent (); BufferedReader Reader = New BufferedReader (New InputStreamReader (Content)); String line; While ((line = reader.readline ()) = null) {builder.append (line); }} Else {// Log.e (ParseJSON.class.toString (), "Failed to download file"); }} Hold (exception e) {} return builder.stosting (); }}   

    And then you can call it like this:

    string result = new web_API_GATE (). Execute ("Your Link Here

    and then Result You are getting true or False from the webservice

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -