Hi Guys, Maybe you all are expert in terms of using RecyclerView in android. This blog is simple example for using filter option with RecyclerView adapter. As for now you will instantiate RecyclerView and set the adapter to RecyclerView as following way. RecyclerView list = (RecyclerView) findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(this)); list.setHasFixedSize(true); ArrayList<Number> numbers = new ArrayList<>(); String ONEs[] = {"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN"}; String TENs[] = {"ZERO", "TEN", "TWENTY", "THIRTY", "FOURTY", "FIFTY", "SIXTY", "SEVENTY", "EIGHTY", "NINETY", "HUNDRED"}; String HUNDREDS[] = {"ZERO", "HUNDRED", "TWO HUND
Here is the simple example of Authentication process using Firebase in Kotlin Programming Language.
Here is the methods to Sign In, Sign Out and delete the account.
If you are really interested in this code, then please share this post with your friends, also share your feedback as comment here.
Thank You
Step 1.
Login into Firebase Console and create your project.Step 2.
Navigate into Authentication and enable your preferred login methods.Step 3.
Create your Android project and add the following classpath into root of the project's build.gradle.classpath 'com.google.gms:google-services:3.1.1'
Step 4.
And then add the following plugin into your module's build.gradle.apply plugin: 'com.google.gms.google-services'
Step 5.
And then add the following dependency into your module's build.gradle.implementation 'com.firebaseui:firebase-ui-auth:3.3.1'That's you wanted to access the Firebase's Authentication API in your project.
Here is the methods to Sign In, Sign Out and delete the account.
Sign In
private fun signIn() { // Choose authentication providers val providers = Arrays.asList(AuthUI.IdpConfig.GoogleBuilder().build(), AuthUI.IdpConfig.PhoneBuilder().build(), AuthUI.IdpConfig.EmailBuilder().build()) // Create and launch sign-in intent startActivityForResult( AuthUI.getInstance() .createSignInIntentBuilder() .setAvailableProviders(providers) .build(), RC_SIGN_IN); } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == RC_SIGN_IN) { val response = IdpResponse.fromResultIntent(data) if (resultCode == RESULT_OK) { // Successfully signed in } else { // Sign in failed, check response for error code } } }
Sign Out
private fun signOut() { AuthUI.getInstance() .signOut(this) .addOnCompleteListener { task -> if (task.isSuccessful) { Toast.makeText(activity, getString(R.string.signed_out), LENGTH_LONG).show() } } }
Delete
private fun delete() { AuthUI.getInstance() .delete(this) .addOnCompleteListener { task -> if (task.isSuccessful) { Toast.makeText(activity, getString(R.string.deleted), LENGTH_LONG).show() } } }
Screenshot
Interesting right?
If you are really interested in this code, then please share this post with your friends, also share your feedback as comment here.
Source code on GitHub
Thank You
Comments
Post a Comment