skip to Main Content

Android Studio – AES Encryption in Kotlin

The Android docs give the following snippet for how to encrypt a message in AES: val plaintext: ByteArray = ... val keygen = KeyGenerator.getInstance("AES") keygen.init(256) val key: SecretKey = keygen.generateKey() val cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING") cipher.init(Cipher.ENCRYPT_MODE, key) val ciphertext: ByteArray =…

VIEW QUESTION

Android Studio – How to refresh list item after sorting immediately

I have a music list obtained from: MusicDatabase.kt override fun getContentProviderValue(): MutableList<Songs> { val songList = mutableListOf<Songs>() val collection = sdk29AndUp { MediaStore.Audio.Media.getContentUri(MediaStore.VOLUME_EXTERNAL) } ?: MediaStore.Audio.Media.EXTERNAL_CONTENT_URI //Get songs from provider context.contentResolver.query( collection, projection, selection, null, PreferenceHelper.storeAllSongsSortOrder //Sort order. ).use {…

VIEW QUESTION

Android Studio – Android Problem adding hint on a TextInputEditText

I want to make a custom dialog that I can re-use to configure some parameters. I added a default hint that I want to modify each time the user opens the Dialog. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent"…

VIEW QUESTION
Back To Top
Search