Fixed
Status Update
Comments
da...@google.com <da...@google.com> #2
This lint check should apply to:
- onCreateView()
- onViewCreated()
- onActivityCreated()
- onViewStateRestored()
As all of those are called each time the fragment's view is created.
- onCreateView()
- onViewCreated()
- onActivityCreated()
- onViewStateRestored()
As all of those are called each time the fragment's view is created.
to...@gmail.com <to...@gmail.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit d26126d23175fc55c77788b95989f1ecc873eb9c
Author: Matthew Fraschilla <fraschilla@google.com>
Date: Mon Oct 07 13:05:15 2019
Add lint check for unsafe livedata observe in Fragments
A Fragment's lifecycle can last longer than its view resulting in
LiveData objects being observed longer than intended. This change
introduces a lint check to warn developers that they should use the
getViewLifecyclOwner() method as the LifecycleOwner when observing
LiveData objects.
Test: new FragmentLiveDataObserveDetectorTest
Bug: 137122478
Change-Id: If002f6be74d9b943f1b43cf2515b20337489b704
A fragment/fragment-lint/src/main/java/androidx/fragment/lint/FragmentLiveDataObserverDetector.kt
A fragment/fragment-lint/src/main/java/androidx/fragment/lint/LintUtils.kt
A fragment/fragment-lint/src/test/java/androidx/fragment/lint/FragmentLiveDataObserveDetectorTest.kt
A fragment/fragment-lint/src/test/java/androidx/fragment/lint/stubs/Stubs.kt
https://android-review.googlesource.com/1137099
https://goto.google.com/android-sha1/d26126d23175fc55c77788b95989f1ecc873eb9c
Branch: androidx-master-dev
commit d26126d23175fc55c77788b95989f1ecc873eb9c
Author: Matthew Fraschilla <fraschilla@google.com>
Date: Mon Oct 07 13:05:15 2019
Add lint check for unsafe livedata observe in Fragments
A Fragment's lifecycle can last longer than its view resulting in
LiveData objects being observed longer than intended. This change
introduces a lint check to warn developers that they should use the
getViewLifecyclOwner() method as the LifecycleOwner when observing
LiveData objects.
Test: new FragmentLiveDataObserveDetectorTest
Bug: 137122478
Change-Id: If002f6be74d9b943f1b43cf2515b20337489b704
A fragment/fragment-lint/src/main/java/androidx/fragment/lint/FragmentLiveDataObserverDetector.kt
A fragment/fragment-lint/src/main/java/androidx/fragment/lint/LintUtils.kt
A fragment/fragment-lint/src/test/java/androidx/fragment/lint/FragmentLiveDataObserveDetectorTest.kt
A fragment/fragment-lint/src/test/java/androidx/fragment/lint/stubs/Stubs.kt
ap...@google.com <ap...@google.com> #4
We've added this Lint check internally and it will be available in Fragment 1.2.0-rc01
Description
Android 7.1
Room 2.1.0 works well, but failed on 2.2.0-alpha01
This happened on an update sql with 3 param's placeholder but 2 of them are the same, maybe this info is helpful.
```
java.lang.IllegalArgumentException: Cannot bind argument at index 3 because the index is out of range. The statement has 2 parameters.
at android.database.sqlite.SQLiteProgram.bind(SQLiteProgram.java:212)
at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:166)
at androidx.sqlite.db.framework.FrameworkSQLiteProgram.bindString(FrameworkSQLiteProgram.java:50)
at one.mixin.android.db.MessageDao_Impl.takeUnseen(XXXDao_Impl.java:1186)
at one.mixin.android.db.DaoExtensionKt$batchMarkReadAndTake$1.invoke(DaoExtension.kt:104)
at one.mixin.android.db.DaoExtensionKt$batchMarkReadAndTake$1.invoke(DaoExtension.kt)
at one.mixin.android.db.XXXDatabaseKt$sam$java_lang_Runnable$0.run(XXXDatabase.kt)
at androidx.room.RoomDatabase.runInTransaction(RoomDatabase.java:391)
```