1. Are you ready for the Galaxy S20? Here is everything we know so far!
  1. Gangul

    Gangul Lurker
    Thread Starter

    signin.java

    Code (Java):
    1.  
    2. package com.example.library;
    3.  
    4. import android.content.DialogInterface;
    5. import android.content.Intent;
    6. import android.os.Bundle;
    7. import android.text.TextUtils;
    8. import android.util.Patterns;
    9. import android.view.View;
    10. import android.view.WindowManager;
    11. import android.widget.EditText;
    12. import android.widget.ImageView;
    13. import android.widget.TextView;
    14. import android.widget.Toast;
    15.  
    16. import androidx.annotation.NonNull;
    17. import androidx.appcompat.app.AlertDialog;
    18. import androidx.appcompat.app.AppCompatActivity;
    19.  
    20. import com.google.android.gms.tasks.OnCompleteListener;
    21. import com.google.android.gms.tasks.OnFailureListener;
    22. import com.google.android.gms.tasks.OnSuccessListener;
    23. import com.google.android.gms.tasks.Task;
    24. import com.google.firebase.auth.AuthResult;
    25. import com.google.firebase.auth.FirebaseAuth;
    26.  
    27. public class signin extends AppCompatActivity {
    28.  
    29.     TextView regsi, sifpwd;
    30.     ImageView sib;
    31.     EditText siema, sipwd;
    32.     FirebaseAuth firebaseAuth;
    33.  
    34.  
    35.  
    36.     @Override
    37.     protected void onCreate(Bundle savedInstanceState) {
    38.         super.onCreate(savedInstanceState);
    39.         setContentView(R.layout.activity_signin);
    40.         getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    41.  
    42.         regsi = findViewById(R.id.regsi);
    43.         sifpwd = findViewById(R.id.sifpwd);
    44.         sib = findViewById(R.id.sib);
    45.         siema = findViewById(R.id.siem);
    46.         sipwd = findViewById(R.id.sipwd);
    47.         firebaseAuth = FirebaseAuth.getInstance();
    48.  
    49.         regsi.setOnClickListener(new View.OnClickListener() {
    50.             @Override
    51.             public void onClick(View view) {
    52.                 if(!signin.this.isFinishing()){
    53.                     startActivity(new Intent(signin.this, signup.class));
    54.                 }
    55.             }
    56.         });
    57.  
    58.  
    59.         sib.setOnClickListener(new View.OnClickListener() {
    60.             @Override
    61.             public void onClick(View v) {
    62.                 String siem = siema.getText().toString().trim();
    63.                 String sip = sipwd.getText().toString().trim();
    64.  
    65.                 if (TextUtils.isEmpty(siem) ) {
    66.                     siema.setError("Email is Required");
    67.                     return;
    68.                 }
    69.                 if (!Patterns.EMAIL_ADDRESS.matcher(siem).matches()){
    70.                     siema.setError("Email is not in format");
    71.                     return;
    72.                 }
    73.                 if(TextUtils.isEmpty(sip)){
    74.                     sipwd.setError("Confirm Password is Required");
    75.                     return;
    76.                 }
    77.                 if (sip.length() < 8){
    78.                     sipwd.setError("Password is Required minimum 8 characters");
    79.                     return;
    80.                 }
    81.  
    82.                 if (firebaseAuth.getCurrentUser() == null){
    83.                     Toast.makeText(signin.this, "User is not registered", Toast.LENGTH_SHORT).show();
    84.                     startActivity(new Intent(getApplicationContext(), signup.class));
    85.                 }
    86.  
    87.                 firebaseAuth.signInWithEmailAndPassword(siem, sip).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
    88.                     @Override
    89.                     public void onComplete(@NonNull Task<AuthResult> task) {
    90.                         if (task.isSuccessful()){
    91.                             Toast.makeText(signin.this, "User logged in successfully", Toast.LENGTH_SHORT).show();
    92.                             startActivity(new Intent(getApplicationContext(),load.class));
    93.                         }
    94.                         else {
    95.                             Toast.makeText(signin.this, "User login unsuccessful"+ task.getException().getMessage(), Toast.LENGTH_SHORT).show();
    96.                         }
    97.                     }
    98.                 });
    99.  
    100.             }
    101.         });
    102.  
    103.         sifpwd.setOnClickListener(new View.OnClickListener() {
    104.             @Override
    105.             public void onClick(View view) {
    106.                 EditText resetEmail = new EditText(view.getContext());
    107.                 AlertDialog.Builder passwordResetDialog = new AlertDialog.Builder(view.getContext());
    108.                 passwordResetDialog.setTitle("Reset Password?");
    109.                 passwordResetDialog.setMessage("Enter Your Email to Received Reset Link:");
    110.                 passwordResetDialog.setView(resetEmail);
    111.  
    112.                 passwordResetDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
    113.                     @Override
    114.                     public void onClick(DialogInterface dialogInterface, int i) {
    115.                         String mail = resetEmail.getText().toString();
    116.                         firebaseAuth.sendPasswordResetEmail(mail).addOnSuccessListener(new OnSuccessListener<Void>() {
    117.                             @Override
    118.                             public void onSuccess(Void aVoid) {
    119.                                 Toast.makeText(signin.this, "Reset mail sent to you", Toast.LENGTH_SHORT).show();
    120.                             }
    121.                         }).addOnFailureListener(new OnFailureListener() {
    122.                             @Override
    123.                             public void onFailure(@NonNull Exception e) {
    124.                                 Toast.makeText(signin.this, "Error has been occur"+ e.getMessage(), Toast.LENGTH_SHORT).show();
    125.                             }
    126.                         });
    127.  
    128.                     }
    129.                 });
    130.                 passwordResetDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
    131.                     @Override
    132.                     public void onClick(DialogInterface dialogInterface, int i) {
    133.  
    134.                     }
    135.                 });
    136.  
    137.                 passwordResetDialog.create().show();
    138.             }
    139.         });
    140.     }
    141. }

    [startActivity(new Intent(signin.this, signup.class));] this not working please help. I checked all the resolve mechanisms throughout the internet. Error is shown below.

    W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@71eb264
    I/PhoneWindow: initSystemUIColor
    I/chatty: uid=10220(com.example.library) identical 2 lines
    D/Surface: Surface::connect(this=0x724b648000,api=1)
    D/Surface: Surface::setBufferCount(this=0x724b648000,bufferCount=3)
    D/Surface: Surface::allocateBuffers(this=0x724b648000)
    D/Surface: Surface::disconnect(this=0x723dca3000,api=1)


    Please help me to solve this as soon as possible. I am a basic developer in android and a starter. please when you are saying a solving method please contain it with steps.
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - ActivityThread handleWindowVisibility activity
  1. aprengo
    Replies:
    7
    Views:
    385
  2. SteveP29
    Replies:
    3
    Views:
    2,018
  3. RatherLoopy
    Replies:
    7
    Views:
    852
  4. SteveP29
    Replies:
    5
    Views:
    1,934
  5. Jimbo84
    Replies:
    8
    Views:
    2,405
  6. blazinglazers
    Replies:
    7
    Views:
    1,679
  7. Boowho
    Replies:
    2
    Views:
    1,281
  8. ZepTepi
    Replies:
    24
    Views:
    3,297
  9. EmbersBliss
    Replies:
    4
    Views:
    759
  10. App Update
    Replies:
    0
    Views:
    378

Share This Page

Loading...