Created
December 6, 2020 12:32
-
-
Save gsrathoreniks/9669802b3fad80b8f0842912e7d1bf25 to your computer and use it in GitHub Desktop.
MainActivity.kt
This file contains 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 `in`.gsrathoreniks.validationdemo | |
import android.annotation.SuppressLint | |
import androidx.appcompat.app.AppCompatActivity | |
import android.os.Bundle | |
import android.view.View | |
import com.google.android.material.button.MaterialButton | |
import com.google.android.material.textfield.TextInputEditText | |
class MainActivity : AppCompatActivity() { | |
private lateinit var et : TextInputEditText | |
lateinit var btn : MaterialButton | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
setupViews() | |
} | |
@SuppressLint("SetTextI18n") | |
private fun setupViews(){ | |
et = findViewById(R.id.et) | |
btn = findViewById(R.id.btn) | |
btn.setOnClickListener { view -> | |
ValidationUtil.isValidUsername(et, et.text.toString()) | |
ValidationUtil.isValidUsername(view = et,username = et.text.toString()) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment