0% found this document useful (0 votes)
32 views1 page

mutlithreaded To Increase The Speed of The Appeared Public Class Extends

The document describes a VerifiedProfileUpdater class that extends the Thread class. The class contains fields for user details, authentication objects, and storage references. The constructor initializes these fields. The UploadDetails method uploads the profile details to the database, displays a success toast on success or deletes the user and shows an error toast on failure.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views1 page

mutlithreaded To Increase The Speed of The Appeared Public Class Extends

The document describes a VerifiedProfileUpdater class that extends the Thread class. The class contains fields for user details, authentication objects, and storage references. The constructor initializes these fields. The UploadDetails method uploads the profile details to the database, displays a success toast on success or deletes the user and shows an error toast on failure.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//mutlithreaded to increase the speed of the appeared

public class VerifiedProfileUpdater extends Thread{

FirebaseUser user;
FirebaseFirestore mFirestoreDB;
FirebaseAuth mAuth;
Activity mActivity;
Context mContext;
Map<String, Object> profileDetails = new HashMap<>();
ProgressBar mProgressBar;
FirebaseStorage mFirebaseStorage;

VerifiedProfileUpdater(Context context, Activity activity, Map<String,Object> profileDetails,


FirebaseUser user, FirebaseAuth auth, FirebaseFirestore db, FirebaseStorage mFirebaseStorage){
this.mContext = context;
this.profileDetails = profileDetails;
this.user = user;
this.mAuth = auth;
this.mFirestoreDB = db;
this.mActivity = activity;
this.mFirebaseStorage = mFirebaseStorage;

UploadDetails();
}

public void UploadDetails(){

mFirestoreDB.collection("users")
.document(user.getUid()).set(profileDetails).addOnSuccessListener(new
OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(mContext,"Account created successfully",Toast.LENGTH_SHORT).show();
mContext.startActivity(new Intent(mContext,HomePage.class));
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(mContext,"Error ! Try after sometime",Toast.LENGTH_SHORT).show();
user.delete()
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(!task.isSuccessful()){
Toast.makeText(mContext,"Bug Report #1",Toast.LENGTH_SHORT).show();
}
}
});
}})}

You might also like