This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UploadResults.setOnClickListener(new View.OnClickListener() { | |
| @Override | |
| public void onClick(View v) { | |
| //get EditText into the String format | |
| final String StudentRollNo = RollNo.getText().toString(); | |
| final String StudentTotalMarks = TotalMarks.getText().toString(); | |
| String StudentObtainedMarks = ObtainedMarks.getText().toString(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MainActivity extends AppCompatActivity { | |
| //Declare globally | |
| TextView logout; | |
| EditText RollNo,TotalMarks,ObtainedMarks; | |
| TextView UploadResults,SeeMarksDetails; | |
| FirebaseAuth mAuth; | |
| FirebaseDatabase database; | |
| DatabaseReference myRef; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| protected void onStart() | |
| { | |
| super.onStart(); | |
| if (currentUser != null) //check if current user is logged in | |
| { | |
| sendUserToMainActivity(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mAuth.signInWithEmailAndPassword(email, password) //use Firebase method to signin | |
| .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() | |
| { | |
| @Override | |
| public void onComplete(@NonNull Task<AuthResult> task) | |
| { | |
| if (task.isSuccessful()) | |
| { | |
| // Sign in success, update UI with the signed-in user's information | |
| Toast.makeText(LoginActivity.this, "Login Successful!!!", Toast.LENGTH_SHORT).show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //When the btn is clicked | |
| CreateAccount.setOnClickListener(new View.OnClickListener() { | |
| @Override | |
| public void onClick(View v) { | |
| //get EditText into the String format | |
| final String FullName = fullName.getText().toString(); | |
| final String email = emailEdtText.getText().toString(); | |
| String password = passwordEdtText.getText().toString(); | |
| String repeatPassword = RepeatPasswordEdtText.getText().toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SignUp extends AppCompatActivity { | |
| //Declare globally | |
| TextView GoToSignIn, CreateAccount; | |
| EditText fullName,emailEdtText,passwordEdtText,RepeatPasswordEdtText; | |
| RadioButton radioMale,radioFeMale; | |
| FirebaseAuth mAuth; | |
| FirebaseDatabase database; | |
| DatabaseReference myRef; | |
| String gender=""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.arslan6015.loginwithgoogle; | |
| import android.os.Bundle; | |
| import android.util.Log; | |
| import android.view.View; | |
| import android.widget.Button; | |
| import androidx.annotation.NonNull; | |
| import androidx.appcompat.app.AppCompatActivity; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Update a node in database | |
| update = findViewById(R.id.update); | |
| update.setOnClickListener(new View.OnClickListener() { | |
| @Override | |
| public void onClick(View v) { | |
| FirebaseDatabase database1 = FirebaseDatabase.getInstance(); | |
| DatabaseReference reference = database1.getReference().child("message").child("java").child("user"); | |
| reference.setValue("arslan khan") | |
| //you can also attach listenr just to know whetehr it is successful or not | |
| .addOnSuccessListener(new OnSuccessListener<Void>() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Delete Node data from database | |
| button2 = findViewById(R.id.button2); | |
| button2.setOnClickListener(new View.OnClickListener() { | |
| @Override | |
| public void onClick(View v) { | |
| DatabaseReference dbNode = FirebaseDatabase.getInstance().getReference().getRoot().child("python").child("user"); | |
| dbNode.setValue(null); | |
| //or you can delte the node with the following code also | |
| DatabaseReference dbNodetwo = FirebaseDatabase.getInstance().getReference().getRoot() | |
| .child("php").child("User"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //For recyclerView | |
| implementation "androidx.recyclerview:recyclerview:1.1.0" | |
| // For control over item selection of both touch and mouse driven selection | |
| implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc01" |
NewerOlder