Category : kotlin

There is an argument categoryChosen: Int (def = 0) in the action opening the VocabularyFragment, and I need to pass the number from the JetpackDatastore every time I open the Fragment through the BottonNavigationMenu button. How can I do that? Thanks in advance. Bottom navigation menu: <menu xmlns:android="http://schemas.android.com/apk/res/android"> // other items <item android:id="@+id/vocabularyFragment" android:title="Vocabulary" android:icon="@drawable/ic_list" ..

Read more

I want to get this full URL: https://firebasestorage.googleapis.com/v0/b/myapppakage-f7aa6.appspot.com/o/flat%2044%2F1image_1.jpg?alt=media&token=8907b845-a1f5-4bdb-8e76-215fc6fc5129 I want to show images in android slider using full URL. I got this URL gs://myapppakage-f7aa6.appspot.com/flat 44/image_1.jpg But I can`t access images to show in my slider. My Kotlin Code private fun retriveImagesFromStorage(flatName: String) { val firebaseStorage = FirebaseStorage.getInstance().reference val storageRef: StorageReference = firebaseStorage.child(flatName) storageRef.listAll().addOnSuccessListener { result ..

Read more

MY CODE ,,, //key genration val keygen = KeyGenerator.getInstance("AES") keygen.init(256) val key = keygen.generateKey() keyTV.setText(key.toString()) encryptbtn.setOnClickListener(View.OnClickListener { val plaintext = message.text.toString() // object of cipher val cipher = Cipher.getInstance("AES") cipher.init(Cipher.ENCRYPT_MODE,key) // encrypted message val ciphertext = cipher.doFinal(plaintext.toByteArray()) encryptMsgTV.setText(ciphertext.toString()) }) decryptbtn.setOnClickListener(View.OnClickListener { val ciphertext = encryptMsgTV.text.toString() val decipher = Cipher.getInstance("AES") decipher.init(Cipher.DECRYPT_MODE,key) val plaintext = decipher.doFinal(ciphertext.toByteArray()) decryptMsgTV.setText(plaintext.toString()) ..

Read more

I have just created new project in android studio (haven’t change a single line yet, fully brand new) and by first run on emulator I’m getting following error: java.lang.IllegalStateException: Activity [email protected] does not have a NavController set on 2131230989 Code Activity class MainActivity : AppCompatActivity() { private lateinit var appBarConfiguration: AppBarConfiguration override fun onCreate(savedInstanceState: Bundle?) ..

Read more

I’m new in kotlin an android. In my app I want to get the ip of the mobile in wifi network and display it. fun runDvr(view: View) { GetMyIP_A(); } My options: 1) private fun GetMyIP_A() { val wm = applicationContext.getSystemService(WIFI_SERVICE) as WifiManager val ipAddress: String = Formatter.formatIpAddress(wm.connectionInfo.ipAddress) Log.i("TAG", "IP: $ipAddress") } This works but ..

Read more