Guest User

Untitled

a guest
Dec 26th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. XML FILE..
  2.  
  3. xmlns:tools="http://schemas.android.com/tools"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. tools:context=".MainActivity">
  7.  
  8. <EditText
  9. android:id="@+id/edt_1"
  10. android:layout_width="325dp"
  11. android:layout_height="45dp"
  12. android:layout_alignParentTop="true"
  13. android:layout_centerHorizontal="true"
  14. android:layout_marginTop="172dp"
  15.  
  16.  
  17. android:hint="@string/ed_usr"
  18. android:inputType="text" />
  19.  
  20. <EditText
  21. android:id="@+id/edt_2"
  22. android:layout_width="325dp"
  23. android:layout_height="45dp"
  24. android:layout_alignParentBottom="true"
  25. android:layout_centerHorizontal="true"
  26. android:layout_marginBottom="215dp"
  27.  
  28.  
  29.  
  30. android:ems="10"
  31. android:hint="@string/ed_psw"
  32. android:inputType="textPassword" />
  33.  
  34. <TextView
  35. android:id="@+id/textView4"
  36. android:layout_width="wrap_content"
  37. android:layout_height="wrap_content"
  38. android:layout_alignParentBottom="true"
  39. android:layout_centerHorizontal="true"
  40. android:layout_marginBottom="85dp"
  41. android:text="@string/tv_reg"
  42. android:textSize="17sp"
  43. android:textColor="#FF000000"/>
  44.  
  45. <Button
  46. android:id="@+id/btn_log"
  47. android:layout_width="wrap_content"
  48. android:layout_height="wrap_content"
  49. android:layout_alignParentBottom="true"
  50. android:layout_centerHorizontal="true"
  51. android:layout_marginBottom="142dp"
  52. android:text="@string/btn_lgn" />
  53.  
  54.  
  55. </RelativeLayout>
  56.  
  57.  
  58. JAVA FILE..
  59. package com.example.sardaralialam.mazdoor;
  60.  
  61. import android.content.Intent;
  62. import android.support.v7.app.AppCompatActivity;
  63. import android.os.Bundle;
  64. import android.view.View;
  65. import android.widget.Button;
  66. import android.widget.EditText;
  67.  
  68. public class MainActivity extends AppCompatActivity {
  69.  
  70. EditText ed_user , ed_pass ;
  71. Button btn_log ;
  72. String user , pass;
  73. @Override
  74. protected void onCreate(Bundle savedInstanceState) {
  75. super.onCreate(savedInstanceState);
  76. setContentView(R.layout.activity_main);
  77. ed_user = findViewById(R.id.edt_1);
  78. ed_pass = findViewById(R.id.edt_2);
  79.  
  80. user = ed_user.getText().toString();
  81. pass =ed_pass.getText().toString();
  82. btn_log.setOnClickListener(new View.OnClickListener() {
  83. @Override
  84. public void onClick(View v)
  85. Intent it = new Intent(MainActivity.this ,
  86. MainActivity.class);
  87.  
  88. startActivity(it);
  89. });
  90. }
  91. }
  92.  
  93.  
  94. enter code here
Add Comment
Please, Sign In to add comment