lateinit property initialState has not been initialized
See original GitHub issueHi,
I encountered a problem with CircularProgressButton I wanted to try the behavior of my button, so I called startAnimation() in the onCreate() but I get this exception : lateinit property initialState has not been initialized If I call it after (like in an onClickListener) it works fine
As sample I used a simple project with an empty activity :
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
button.startAnimation()
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<br.com.simplepass.loadingbutton.customViews.CircularProgressButton
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
kotlin 1.3 AndroidX LoadingButtonAndroid 2.0.7
Best regards
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:8 (3 by maintainers)
Top Results From Across the Web
lateinit property has not been initialized - Stack Overflow
I'm using the latest version of butterknife library. The following is my Kotlin class: class MenuItemView : LinearLayout { @BindView(R.
Read more >How to Check if a "lateinit" Variable Has Been Initialized or ...
You can check if the lateinit variable has been initialized or not before using it with the help of isInitialized() method. This method...
Read more >lateinit Property in Kotlin - Suneet Agrawal
Accessing a lateinit property before it has been initialized throws a special exception that clearly identifies the property being accessed and the fact...
Read more >Initializing lazy and lateinit variables in Kotlin - LogRocket Blog
Firstly, memory is not allocated to a lateinit property at the time of declaration. The initialization takes place later when you see fit....
Read more >Kotlin Android Mvp + Dagger 2 Lateinit Property Presenter ...
Dagger2 Android DI lateinit property has not been initialized. 20200604 17:41 Kratos imported from Stackoverflow View { @Inject lateinit var presenter: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Use the version
2.1.3
, this is fixed in that one =]So, for those who have the same issue I found a workaround :