Skip to content

Instantly share code, notes, and snippets.

@Sal7one
Created May 3, 2022 14:54
Show Gist options
  • Save Sal7one/681a6311d0abb1dcf44c2e7a6d26408e to your computer and use it in GitHub Desktop.
Save Sal7one/681a6311d0abb1dcf44c2e7a6d26408e to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
private val secretUserNum = Random().nextInt(100) + 1
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
findViewById<TextView>(R.id.actualPass).text = "Actual pass $secretUserNum "
findViewById<Button>(R.id.decryptBtn).setOnClickListener {
val userEntry = findViewById<EditText>(R.id.passwordEt).text.toString().toInt()
if (secretUserNum == userEntry)
findViewById<TextView>(R.id.mainText).text = "Access Granted "
else
Toast.makeText(this, "Bad Password!", Toast.LENGTH_LONG).show()
}
}
}
@Sal7one
Copy link
Author

Sal7one commented Feb 12, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment