kotlin

onPaymentFailure not getting called in razorpay

拥有回忆 提交于 2021-01-20 13:23:28
问题 i have been implementing an payment gateway using razorpay when i tap on success button it gives the razorpaymentId but when i tap on failure it simply redirect me to netbancking payment page without displaying any toast which is defined in onPaymentError here is my code :-- override fun onPaymentSuccess(razorpayPaymentID: String) { Toast.makeText(this, "Payment successfully done! $razorpayPaymentID", Toast.LENGTH_SHORT).show() Log.e("onPaymentSucess", "Payment successfully done!

onResume does not worked in viewmodel

房东的猫 提交于 2021-01-20 13:11:20
问题 my data is fetched only when it is created...im using viewmodel...when press back button it doesnt update the previous data..onresume is not working in this... i refered this but none of those helped--> Reacting to activity lifecycle in ViewModel i need help thanks in advance activity:-- class MyAccount : BaseClassActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.myaccount) var mActionBarToolbar = findViewById<androidx

onResume does not worked in viewmodel

半城伤御伤魂 提交于 2021-01-20 13:09:42
问题 my data is fetched only when it is created...im using viewmodel...when press back button it doesnt update the previous data..onresume is not working in this... i refered this but none of those helped--> Reacting to activity lifecycle in ViewModel i need help thanks in advance activity:-- class MyAccount : BaseClassActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.myaccount) var mActionBarToolbar = findViewById<androidx

Why not work back button with android navigation component

痴心易碎 提交于 2021-01-20 12:34:35
问题 this my Auth Activity class AuthActivity : AppCompatActivity() { private lateinit var navController: NavController override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val binding = ActivityAuthBinding.inflate(layoutInflater) setContentView(binding.root) navController = Navigation.findNavController(this, fragment.id) NavigationUI.setupActionBarWithNavController(this, navController) } override fun onSupportNavigateUp(): Boolean { return NavigationUI

Why not work back button with android navigation component

我与影子孤独终老i 提交于 2021-01-20 12:34:32
问题 this my Auth Activity class AuthActivity : AppCompatActivity() { private lateinit var navController: NavController override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val binding = ActivityAuthBinding.inflate(layoutInflater) setContentView(binding.root) navController = Navigation.findNavController(this, fragment.id) NavigationUI.setupActionBarWithNavController(this, navController) } override fun onSupportNavigateUp(): Boolean { return NavigationUI

Why not work back button with android navigation component

跟風遠走 提交于 2021-01-20 12:34:09
问题 this my Auth Activity class AuthActivity : AppCompatActivity() { private lateinit var navController: NavController override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val binding = ActivityAuthBinding.inflate(layoutInflater) setContentView(binding.root) navController = Navigation.findNavController(this, fragment.id) NavigationUI.setupActionBarWithNavController(this, navController) } override fun onSupportNavigateUp(): Boolean { return NavigationUI

“Not enough information to infer parameter T” with Kotlin and Android

强颜欢笑 提交于 2021-01-19 12:45:58
问题 I'm trying to replicate the following ListView in my Android app using Kotlin: https://github.com/bidrohi/KotlinListView. Unfortunately I'm getting an error I'm unable to resolve myself. Here's my code: MainActivity.kt: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val listView = findViewById(R.id.list) as ListView listView.adapter = ListExampleAdapter(this) } private class ListExampleAdapter(context: Context) :

Kotlin Init Block in Super class firing with null properties when inheriting from it

点点圈 提交于 2021-01-19 03:07:47
问题 open class Super { open var name : String = "Name1" init { println("INIT block fired with : $name") name = name.toUpperCase() println(name) } } class SubClass(newName : String) : Super() { override var name : String = "Mr. $newName" } fun main(args: Array<String>) { var obj = SubClass("John") println(obj.name) } The above Kotlin code results in the following TypeCastException : INIT block fired with : null Exception in thread "main" kotlin.TypeCastException: null cannot be cast to non-null

Kotlin Init Block in Super class firing with null properties when inheriting from it

有些话、适合烂在心里 提交于 2021-01-19 03:06:59
问题 open class Super { open var name : String = "Name1" init { println("INIT block fired with : $name") name = name.toUpperCase() println(name) } } class SubClass(newName : String) : Super() { override var name : String = "Mr. $newName" } fun main(args: Array<String>) { var obj = SubClass("John") println(obj.name) } The above Kotlin code results in the following TypeCastException : INIT block fired with : null Exception in thread "main" kotlin.TypeCastException: null cannot be cast to non-null

Android alarmManager.setAlarmClock Crash Android 7

牧云@^-^@ 提交于 2021-01-18 06:15:25
问题 I am getting a crash (on android 7 only) when calling alarmmanager.setAlarmClock in a function where i am setting alarm. I have no idea what is wrong here. And how to fix this crash. This is the function which is getting crash when calling alarmManager.setAlarmClock fun setBeforeAlert( context: Context, offset: Long, beforeMin: Int, pendingIntent: PendingIntent ) { if (offset - beforeMin * 60 * 1000 > 0) { val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager if