Advertisement
Guest User

Untitled

a guest
Jan 6th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. package com.example.naufal.restoapps_user;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.Button;
  8. import android.widget.EditText;
  9. import android.widget.TextView;
  10. import android.widget.Toast;
  11.  
  12. /**
  13. * Created by Naufal on 1/2/2017.
  14. */
  15.  
  16. public class login extends Activity {
  17. String userclient = "cxcx";
  18. String Nm;
  19. TextView text;
  20.  
  21.  
  22. String passwordclient = "cxcx";
  23.  
  24. @Override
  25. protected void onCreate(Bundle savedInstanceState) {
  26. super.onCreate(savedInstanceState);
  27. setContentView(R.layout.activity_main);
  28. final EditText username, password;
  29. username = (EditText) findViewById(R.id.editText);
  30. password = (EditText) findViewById(R.id.editText2);
  31. userclient = username.getText().toString();
  32. passwordclient = password.getText().toString();
  33. Button login, reset;
  34. login = (Button) findViewById(R.id.login);
  35. reset = (Button) findViewById(R.id.reset);
  36.  
  37. reset.setOnClickListener(new View.OnClickListener() {
  38. @Override
  39. public void onClick(View v) {
  40. username.setText("");
  41. password.setText("");
  42. }
  43. });
  44. login.setOnClickListener(new View.OnClickListener() {
  45. @Override
  46. public void onClick(View v) {
  47.  
  48. if (username.getText().toString().trim().equals("") || password.getText().toString().trim().equals("")) {
  49. Toast.makeText(login.this, "please input", Toast.LENGTH_SHORT).show();
  50. } else {
  51. try {
  52.  
  53.  
  54. login_client login = new login_client(getApplicationContext(), text = (TextView) findViewById(R.id.textView7));
  55. login.execute(username.getText().toString(), password.getText().toString());
  56. login.nama(username.getText().toString());
  57. login.passwor(password.getText().toString());
  58. text = (TextView) findViewById(R.id.textView7);
  59. String identitas = text.getText().toString();
  60. Toast.makeText(login.this, "check" + identitas + "", Toast.LENGTH_SHORT).show();
  61. if (identitas == "click") {
  62.  
  63. } else {
  64. if (Integer.parseInt(identitas) != 0) {
  65. Intent panel = new Intent(login.this, homepanel.class);
  66. panel.putExtra("identitas", identitas);
  67. startActivity(panel);
  68. finish();
  69.  
  70. } else {
  71. Toast.makeText(login.this, "check", Toast.LENGTH_SHORT).show();
  72. }
  73. }
  74.  
  75. } catch (Exception e) {
  76. Toast.makeText(login.this, "something " + e, Toast.LENGTH_SHORT).show();
  77. }
  78. }
  79. }
  80. });
  81.  
  82. }
  83.  
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement