Apply for Zend Framework Certification Training

Android




<p>Step 1 C:\Users\rajesh.mandal\AndroidStudioProjects\Login\app\src\main\java\com\ example\rajeshmandal\login\LoginActivity.java private AutoCompleteTextView mEmailView; private EditText mPasswordView; private View mProgressView; private View mLoginFormView; private EditText email,password; private Button email_sign_in_button; private RequestQueue requestQueue; private static final String URL=&quot;http://webphplearn.com/api/login.php&quot;; private StringRequest request; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); // Set up the login form. email = (EditText) findViewById(R.id.email); password = (EditText) findViewById(R.id.password); email_sign_in_button = (Button) findViewById(R.id.email_sign_in_button); requestQueue = Volley.newRequestQueue(this); email_sign_in_button.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view){ request = new StringRequest(Request.Method.POST, URL, new Response.Listener() { @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); if(jsonObject.names().get(0).equals(&quot;success&quot;)){ Toast.makeText(getApplicationContext(),&quot;SUCCESS &quot;+jsonObject.getString(&quot;success&quot;),Toast.LENGTH_SHORT).show(); startActivity(new Intent(getApplicationContext(),Welcome.class)); }else{ Toast.makeText(getApplicationContext(),&quot;Error &quot;+jsonObject.getString(&quot;error&quot;),Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }){ @Override protected Map getParams() throws AuthFailureError{ HashMap hashMap = new HashMap(); hashMap.put(&quot;email&quot;,email.getText().toString()); hashMap.put(&quot;password&quot;,password.getText().toString()); return hashMap; } }; requestQueue.add(request); } }); } Step -2 Volly used compile &#39;com.mcxiaoke.volley:library:1.0.17&#39;</p>
                                    

< How To Create login Page In Android How to pass Data From One Activity to Another Activity in android >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top