• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy

Gangul

Lurker
signin.java

Java:
package com.example.library;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Patterns;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;

public class signin extends AppCompatActivity {

    TextView regsi, sifpwd;
    ImageView sib;
    EditText siema, sipwd;
    FirebaseAuth firebaseAuth;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_signin);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

        regsi = findViewById(R.id.regsi);
        sifpwd = findViewById(R.id.sifpwd);
        sib = findViewById(R.id.sib);
        siema = findViewById(R.id.siem);
        sipwd = findViewById(R.id.sipwd);
        firebaseAuth = FirebaseAuth.getInstance();

        regsi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(!signin.this.isFinishing()){
                    startActivity(new Intent(signin.this, signup.class));
                }
            }
        });


        sib.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String siem = siema.getText().toString().trim();
                String sip = sipwd.getText().toString().trim();

                if (TextUtils.isEmpty(siem) ) {
                    siema.setError("Email is Required");
                    return;
                }
                if (!Patterns.EMAIL_ADDRESS.matcher(siem).matches()){
                    siema.setError("Email is not in format");
                    return;
                }
                if(TextUtils.isEmpty(sip)){
                    sipwd.setError("Confirm Password is Required");
                    return;
                }
                if (sip.length() < 8){
                    sipwd.setError("Password is Required minimum 8 characters");
                    return;
                }

                if (firebaseAuth.getCurrentUser() == null){
                    Toast.makeText(signin.this, "User is not registered", Toast.LENGTH_SHORT).show();
                    startActivity(new Intent(getApplicationContext(), signup.class));
                }

                firebaseAuth.signInWithEmailAndPassword(siem, sip).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        if (task.isSuccessful()){
                            Toast.makeText(signin.this, "User logged in successfully", Toast.LENGTH_SHORT).show();
                            startActivity(new Intent(getApplicationContext(),load.class));
                        }
                        else {
                            Toast.makeText(signin.this, "User login unsuccessful"+ task.getException().getMessage(), Toast.LENGTH_SHORT).show();
                        }
                    }
                });

            }
        });

        sifpwd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EditText resetEmail = new EditText(view.getContext());
                AlertDialog.Builder passwordResetDialog = new AlertDialog.Builder(view.getContext());
                passwordResetDialog.setTitle("Reset Password?");
                passwordResetDialog.setMessage("Enter Your Email to Received Reset Link:");
                passwordResetDialog.setView(resetEmail);

                passwordResetDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        String mail = resetEmail.getText().toString();
                        firebaseAuth.sendPasswordResetEmail(mail).addOnSuccessListener(new OnSuccessListener<Void>() {
                            @Override
                            public void onSuccess(Void aVoid) {
                                Toast.makeText(signin.this, "Reset mail sent to you", Toast.LENGTH_SHORT).show();
                            }
                        }).addOnFailureListener(new OnFailureListener() {
                            @Override
                            public void onFailure(@NonNull Exception e) {
                                Toast.makeText(signin.this, "Error has been occur"+ e.getMessage(), Toast.LENGTH_SHORT).show();
                            }
                        });

                    }
                });
                passwordResetDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {

                    }
                });

                passwordResetDialog.create().show();
            }
        });
    }
}


[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.
 
Back
Top Bottom