Guest User

Untitled

a guest
Nov 29th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. E/AndroidRuntime: FATAL EXCEPTION: main
  2. Process: shop.easy.app.x.com.x, PID: 10183
  3. java.lang.RuntimeException: Unable to start activity ComponentInfo{shop.easy.app.x.com.x/shop.easy.app.x.com.x.Acceso}: java.lang.ClassCastException: android.support.v7.widget.AppCompatAutoCompleteTextView cannot be cast to com.rengwuxian.materialedittext.MaterialEditText
  4. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
  5. at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
  6. at android.app.ActivityThread.-wrap11(Unknown Source:0)
  7. at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
  8. at android.os.Handler.dispatchMessage(Handler.java:105)
  9. at android.os.Looper.loop(Looper.java:164)
  10. at android.app.ActivityThread.main(ActivityThread.java:6541)
  11. at java.lang.reflect.Method.invoke(Native Method)
  12. at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
  13. at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
  14. Caused by: java.lang.ClassCastException: android.support.v7.widget.AppCompatAutoCompleteTextView cannot be cast to com.rengwuxian.materialedittext.MaterialEditText
  15. at shop.easy.app.x.com.x.Acceso.onCreate(Acceso.java:35)
  16. at android.app.Activity.performCreate(Activity.java:6975)
  17. at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
  18. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
  19. at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
  20. at android.app.ActivityThread.-wrap11(Unknown Source:0) 
  21. at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
  22. at android.os.Handler.dispatchMessage(Handler.java:105) 
  23. at android.os.Looper.loop(Looper.java:164) 
  24. at android.app.ActivityThread.main(ActivityThread.java:6541) 
  25. at java.lang.reflect.Method.invoke(Native Method) 
  26. at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
  27. at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
  28.  
  29. package shop.easy.app.x.com.x;
  30.  
  31. EditText edtPhone,edtPassword;
  32. Button btnSignIn;
  33.  
  34.  
  35. @Override
  36. protected void onCreate(Bundle savedInstanceState) {
  37. super.onCreate(savedInstanceState);
  38. setContentView(R.layout.activity_main);
  39.  
  40.  
  41. edtPhone = (MaterialEditText)findViewById(R.id.edtPhone);
  42. edtPassword = (MaterialEditText)findViewById(R.id.edtPassword);
  43. btnSignIn = (Button)findViewById(R.id.btnSignIn);
  44.  
  45.  
  46.  
  47. //init firebase
  48.  
  49. final FirebaseDatabase database = FirebaseDatabase.getInstance();
  50. final DatabaseReference table_user = database.getReference("Usuario");
  51.  
  52. btnSignIn.setOnClickListener(new View.OnClickListener() {
  53. @Override
  54. public void onClick(View view) {
  55.  
  56. final ProgressDialog mDialog = new ProgressDialog(Acceso.this);
  57. mDialog.setMessage("Por favor espera...");
  58. mDialog.show();
  59.  
  60. table_user.addValueEventListener(new ValueEventListener() {
  61.  
  62.  
  63. @Override
  64. public void onDataChange(DataSnapshot dataSnapshot) {
  65.  
  66. //comprobar si el usuario no existe en la base de datos
  67. if (dataSnapshot.child(edtPhone.getText().toString()).exists()) {
  68.  
  69. //Informacion usuario
  70.  
  71. mDialog.dismiss();
  72. Usuario usuario = dataSnapshot.child(edtPhone.getText().toString()).getValue(Usuario.class);
  73. if (usuario.getContraseña().equals(edtPassword.getText().toString())) {
  74. {
  75. Intent homeintent = new Intent(Acceso.this,Inicio.class);
  76. Common.currentUsuario = usuario;
  77. startActivity(homeintent);
  78. finish();
  79. }
  80. } else {
  81. Toast.makeText(Acceso.this, "Constraseña incorrecta !!", Toast.LENGTH_SHORT).show();
  82. }
  83. }
  84. else
  85. {
  86. mDialog.dismiss();
  87. Toast.makeText(Acceso.this, "Usuario no registrado en base de dato", Toast.LENGTH_SHORT).show();
  88. }
  89.  
  90. }
  91.  
  92. @Override
  93. public void onCancelled(DatabaseError databaseError) {
  94. }
  95. });
  96. }
  97. });
  98.  
  99. }
Add Comment
Please, Sign In to add comment