kotlin

Object is changed after sending it to another Fragment

回眸只為那壹抹淺笑 提交于 2021-02-11 06:16:48
问题 So, I have a really weird issue, I pass an object from Fragment A to Fragment B , I modify this object in a new instance in Fragment B, but after I change a value on this object it also changes that value when I pop Framgment B and that object keeps modified now also for Fragment A Fragment A ... override fun onItemClick(v: View?, position: Int) { searchView.clearFocus() val bundle = Bundle() bundle.putSerializable("shop", landingAdapter.getItem(position)) findNavController().navigate(R.id

Object is changed after sending it to another Fragment

旧城冷巷雨未停 提交于 2021-02-11 06:16:48
问题 So, I have a really weird issue, I pass an object from Fragment A to Fragment B , I modify this object in a new instance in Fragment B, but after I change a value on this object it also changes that value when I pop Framgment B and that object keeps modified now also for Fragment A Fragment A ... override fun onItemClick(v: View?, position: Int) { searchView.clearFocus() val bundle = Bundle() bundle.putSerializable("shop", landingAdapter.getItem(position)) findNavController().navigate(R.id

Object is changed after sending it to another Fragment

情到浓时终转凉″ 提交于 2021-02-11 06:16:07
问题 So, I have a really weird issue, I pass an object from Fragment A to Fragment B , I modify this object in a new instance in Fragment B, but after I change a value on this object it also changes that value when I pop Framgment B and that object keeps modified now also for Fragment A Fragment A ... override fun onItemClick(v: View?, position: Int) { searchView.clearFocus() val bundle = Bundle() bundle.putSerializable("shop", landingAdapter.getItem(position)) findNavController().navigate(R.id

Kotlin + SpringBootTest + Junit 5 + AutoConfigureMockMvc: test passing when it was supposed to fail (seems @BeforeEach not taking effect)

大城市里の小女人 提交于 2021-02-11 04:52:41
问题 I coded a very simple and common CRUD in Kotlin. I want to do basic tests as testing post, delete, get and put. Probably I understood something wrong: I used Beforeeach aimed to insert a register so I could check during get test. I don't get exception but it seems during get test it always returning ok when it should be NOT_FOUND for any other id different than 1 in bellow test. Any clue or guidance in right direction will be wellcome even if see other bad practice bellow based on my purpose

Kotlin + SpringBootTest + Junit 5 + AutoConfigureMockMvc: test passing when it was supposed to fail (seems @BeforeEach not taking effect)

[亡魂溺海] 提交于 2021-02-11 04:51:13
问题 I coded a very simple and common CRUD in Kotlin. I want to do basic tests as testing post, delete, get and put. Probably I understood something wrong: I used Beforeeach aimed to insert a register so I could check during get test. I don't get exception but it seems during get test it always returning ok when it should be NOT_FOUND for any other id different than 1 in bellow test. Any clue or guidance in right direction will be wellcome even if see other bad practice bellow based on my purpose

Kotlin cannot create an instance of ViewModel

假如想象 提交于 2021-02-11 04:32:57
问题 I've been getting the following error against my ViewModel: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cryptpass_kt/com.example.cryptpass_kt.MainActivity}: java.lang.RuntimeException: Cannot create an instance of class com.example.cryptpass_kt.EntryViewModel at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2853) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2928) at android.app.ActivityThread.-wrap11(Unknown

Kotlin cannot create an instance of ViewModel

穿精又带淫゛_ 提交于 2021-02-11 04:28:59
问题 I've been getting the following error against my ViewModel: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cryptpass_kt/com.example.cryptpass_kt.MainActivity}: java.lang.RuntimeException: Cannot create an instance of class com.example.cryptpass_kt.EntryViewModel at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2853) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2928) at android.app.ActivityThread.-wrap11(Unknown

Kotlin cannot create an instance of ViewModel

二次信任 提交于 2021-02-11 04:28:20
问题 I've been getting the following error against my ViewModel: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cryptpass_kt/com.example.cryptpass_kt.MainActivity}: java.lang.RuntimeException: Cannot create an instance of class com.example.cryptpass_kt.EntryViewModel at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2853) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2928) at android.app.ActivityThread.-wrap11(Unknown

How to check Google Mobile Services enable in device or not?

北战南征 提交于 2021-02-11 04:27:58
问题 I have to check if google services are active on the device. How can I check it? Looking just play services is enough? I need this check for Huawei services. 回答1: final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status != ConnectionResult.SUCCESS) { Log.e(TAG, GooglePlayServicesUtil.getErrorString(status)); return false; } else { Log.i(TAG, GooglePlayServicesUtil.getErrorString(status)); return true; } 回答2: I think this code will help you final int status =

How to check Google Mobile Services enable in device or not?

橙三吉。 提交于 2021-02-11 04:27:27
问题 I have to check if google services are active on the device. How can I check it? Looking just play services is enough? I need this check for Huawei services. 回答1: final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status != ConnectionResult.SUCCESS) { Log.e(TAG, GooglePlayServicesUtil.getErrorString(status)); return false; } else { Log.i(TAG, GooglePlayServicesUtil.getErrorString(status)); return true; } 回答2: I think this code will help you final int status =