Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- E/AndroidRuntime: FATAL EXCEPTION: main
- Process: shop.easy.app.x.com.x, PID: 10183
- 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
- at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
- at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
- at android.app.ActivityThread.-wrap11(Unknown Source:0)
- at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
- at android.os.Handler.dispatchMessage(Handler.java:105)
- at android.os.Looper.loop(Looper.java:164)
- at android.app.ActivityThread.main(ActivityThread.java:6541)
- at java.lang.reflect.Method.invoke(Native Method)
- at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
- at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
- Caused by: java.lang.ClassCastException: android.support.v7.widget.AppCompatAutoCompleteTextView cannot be cast to com.rengwuxian.materialedittext.MaterialEditText
- at shop.easy.app.x.com.x.Acceso.onCreate(Acceso.java:35)
- at android.app.Activity.performCreate(Activity.java:6975)
- at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
- at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
- at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
- at android.app.ActivityThread.-wrap11(Unknown Source:0)
- at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
- at android.os.Handler.dispatchMessage(Handler.java:105)
- at android.os.Looper.loop(Looper.java:164)
- at android.app.ActivityThread.main(ActivityThread.java:6541)
- at java.lang.reflect.Method.invoke(Native Method)
- at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
- at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
- package shop.easy.app.x.com.x;
- EditText edtPhone,edtPassword;
- Button btnSignIn;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- edtPhone = (MaterialEditText)findViewById(R.id.edtPhone);
- edtPassword = (MaterialEditText)findViewById(R.id.edtPassword);
- btnSignIn = (Button)findViewById(R.id.btnSignIn);
- //init firebase
- final FirebaseDatabase database = FirebaseDatabase.getInstance();
- final DatabaseReference table_user = database.getReference("Usuario");
- btnSignIn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- final ProgressDialog mDialog = new ProgressDialog(Acceso.this);
- mDialog.setMessage("Por favor espera...");
- mDialog.show();
- table_user.addValueEventListener(new ValueEventListener() {
- @Override
- public void onDataChange(DataSnapshot dataSnapshot) {
- //comprobar si el usuario no existe en la base de datos
- if (dataSnapshot.child(edtPhone.getText().toString()).exists()) {
- //Informacion usuario
- mDialog.dismiss();
- Usuario usuario = dataSnapshot.child(edtPhone.getText().toString()).getValue(Usuario.class);
- if (usuario.getContraseña().equals(edtPassword.getText().toString())) {
- {
- Intent homeintent = new Intent(Acceso.this,Inicio.class);
- Common.currentUsuario = usuario;
- startActivity(homeintent);
- finish();
- }
- } else {
- Toast.makeText(Acceso.this, "Constraseña incorrecta !!", Toast.LENGTH_SHORT).show();
- }
- }
- else
- {
- mDialog.dismiss();
- Toast.makeText(Acceso.this, "Usuario no registrado en base de dato", Toast.LENGTH_SHORT).show();
- }
- }
- @Override
- public void onCancelled(DatabaseError databaseError) {
- }
- });
- }
- });
- }
Add Comment
Please, Sign In to add comment