kotlin.NotImplementedError: An operation is not implemented: not implemented Error from ImageButton Click

Just remove TODO( … ) from your onClickListener: override fun onClick(v: View?) { // No TODO here when (v?.id) { … } } TODO(…) is Kotlin function which always throws NotImplementedError. If you want to mark something with TODO but to not throw exception – just use TODO with comments: override fun onClick(v: View?) { … Read more

Android – save/restore fragment state

When a fragment is moved to the backstack, it isn’t destroyed. All the instance variables remain there. So this is the place to save your data. In onActivityCreated you check the following conditions: Is the bundle != null? If yes, that’s where the data is saved (probably orientation change). Is there data saved in instance … Read more

Preventing the back button from cancelling a DialogFragment

How about using setCancelable? Did you try it? From the Docs: Control whether the shown Dialog is cancelable. Use this instead of directly calling Dialog.setCancelable(boolean), because DialogFragment needs to change its behavior based on this For custom DialogFragment Add isCancelable = false at onCreateDialog

Fragment already added IllegalStateException

In the end my workaround was to execute remove() of the previous fragment and add() the new one. Although that’s what replace() method was meant to do. But I am still guessing why replace() method didn’t work properly in this case. It is really weird and I want to discard that it is because I … Read more

How to start shared element transition using Fragments?

I had the same problem but had it working by adding a new fragment from another fragment. The following link is very helpful in getting started on this: https://developer.android.com/training/material/animations.html#Transitions Following is my code that works. I’m animating an ImageView from one fragment to the other. Make sure the View you want to animate has the … Read more

How to determine fragment restored from backstack

I think that most simple way is do this for example in onViewCreated() method: if (savedInstanceState == null && !mAlreadyLoaded) { mAlreadyLoaded = true; // Do this code only first time, not after rotation or reuse fragment from backstack } Because when android put fragment on backstack, it only destroy its view, but don’t kill … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)