Advertisement
Guest User

Untitled

a guest
Sep 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. package com.example.martin.helha_base;
  2.  
  3. import android.support.v7.app.AppCompatActivity;
  4. import android.os.Bundle;
  5. import android.util.Log;
  6. import android.view.View;
  7. import android.widget.Button;
  8. import android.widget.EditText;
  9. import android.widget.TextView;
  10.  
  11. import org.w3c.dom.Text;
  12.  
  13. public class MainActivity extends AppCompatActivity {
  14. private TextView tvExample, tvUsername, tvPassword;
  15.  
  16. private Button btnExample,btnSignin, btnReset;
  17. private EditText etUsername, etPassword;
  18. @Override
  19. protected void onCreate(Bundle savedInstanceState) {
  20. super.onCreate(savedInstanceState);
  21. setContentView(R.layout.activity_main);
  22.  
  23. this.tvExample = (TextView)findViewById(R.id.tv_main_example);
  24.  
  25. this.tvExample.setText("Hello world");
  26.  
  27. this.btnExample = (Button)findViewById(R.id.btn_main_exemple);
  28. this.btnExample.setOnClickListener(new View.OnClickListener() {
  29. @Override
  30. public void onClick (View v) {
  31.  
  32. }
  33. });
  34.  
  35. this.etUsername = (EditText)findViewById(R.id.et_username);
  36. this.etPassword = (EditText)findViewById(R.id.et_password);
  37.  
  38. this.btnSignin = (Button)findViewById(R.id.btn_signin);
  39. this.btnReset = (Button)findViewById(R.id.btn_signreset);
  40.  
  41. this.btnSignin.setOnClickListener(new View.OnClickListener() {
  42. @Override
  43. public void onClick(View v) {
  44. signInAction();
  45. }
  46. });
  47.  
  48. this.btnReset.setOnClickListener(new View.OnClickListener() {
  49. @Override
  50. public void onClick(View v) {
  51. resetAction();
  52. }
  53. });
  54. }
  55.  
  56. private void resetAction() {
  57. this.etUsername.setText("");
  58. this.etPassword.setText("");
  59. }
  60.  
  61. private void signInAction() {
  62. String username = this.etUsername.getText().toString();
  63. String password = this.etPassword.getText().toString();
  64.  
  65. Log.d("Connexion",String.format("%s - %s",username, password));
  66.  
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement