android-jetpack

Can i use a newer version of sqlite in my project through Jetpack?

独自空忆成欢 提交于 2019-12-13 03:34:31
问题 We have come to a condition where we want to use the "lead" and "lag" functions in android but they don't function unless your sqlite version is at least 3.2. Is it possible for our project to use the newer sqllite versions through Jetpack, and if so, how? 回答1: Is it possible for our project to use the newer sqllite versions through Jetpack Jetpack does not directly give you a new SQLite version. However, if you are using Room, you can use a custom implementation of the SupportSQLiteDatabase

PageKeyedDataSource loadAfter doesnt get fire

醉酒当歌 提交于 2019-12-12 21:49:56
问题 In my fragment, I integrated android jetpack paging library and the data source I using PageKeyedDataSource with retrofit API callback. the code runs as excepted and loads the data to recyclerview but after I scroll to the bottom, it supposed to load more data by firing loadAfter function in data source class but it didn't I also switched to ItemKeyedDataSource still it fails to execute is my code wrong or the plugin have an issue! but in some demo apps which I found in GitHub works perfectly

Ignoring navigate() call: FragmentManager has already saved its state

為{幸葍}努か 提交于 2019-12-12 09:38:25
问题 I'm using navigation in MainActivity , then I start SecondActivity (for result). After finish of SecondActivity I would like to continue with navigation in MainActivity , but FragmentManager has saved his state already. On Navigation.findNavController(view).navigate(R.id.action_next, bundle) I receive log message: Ignoring navigate() call: FragmentManager has already saved its state How I can continue in navigation? 回答1: You must always call super.onActivityResult() in your Activity's

Android Navigation Component: java.lang.IllegalStateException: unknown destination during restore

蓝咒 提交于 2019-12-11 17:47:09
问题 I'm using Android's AAC Navigation Component and have implemented conditional navigation for my login flow as described in this post: Navigation Architecture Component - Login screen Now everything appears to be working, however after being navigated to the login screen and successfully logging in then navigating back to the main screen, on rotation the app crashes with the following error: --------- beginning of crash 2019-02-02 13:08:28.423 6030-6030/uk.co.victoriajanedavis.chatapp E

How to navigate to Half Fragment ? (Navigation Architecture Component)

六月ゝ 毕业季﹏ 提交于 2019-12-11 17:39:58
问题 I am trying Navigation architecture Component in My app. Earlier i Used Fragment Transaction's to achieve the below feature. Basically i want to navigate from. FragmentA->FragmentB (custom fragment partially transparent and half of screen size) If i am using Navigation component and try Navigation.findNavController(view).navigate(R.id.action_FragmentA_to_FragmentB) Then the result is the FragmentA is replaced by FragmentB and the background fragment is not visible. I want to know of a

Jetpack's BiometricPrompt (androidx.biometric.BiometricPrompt) throws NullPointerException

China☆狼群 提交于 2019-12-11 17:24:22
问题 I'm using androidx.biometric:biometric:1.0.0-alpha03 in a test project and when pushing the negative button I always get the following error message: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence androidx.biometric.BiometricFragment.getNegativeButtonText()' on a null object reference at androidx.biometric.BiometricPrompt$1$1.run(BiometricPrompt.java:329) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util

why SavedStateHandle.set(java.lang.String, java.lang.Object) on a null object reference

房东的猫 提交于 2019-12-11 16:03:16
问题 i use viewmodel to bind fragment to viewmodel,and use savestate,this is my code : MyViewModel myViewModel = ViewModelProviders.of(getActivity(), new SavedStateViewModelFactory(getActivity().getApplication(),this)).get(MyViewModel.class); FragmentTaskBinding taskBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_task, container, false); taskBinding.setData(myViewModel); taskBinding.setLifecycleOwner(getActivity()); private SavedStateHandle handle; public MyViewModel(@NonNull

How to get data from DataSource.Factory

我是研究僧i 提交于 2019-12-11 10:05:28
问题 I have to call this method to get all the persons. I cannot modify this method at all. @Query("SELECT * FROM PERSON_TABLE ORDER BY NAME DESC" abstract fun getElements(): DataSource.Factory<Int, Person> Then in an Activity I am calling it like this: override fun onCreate(...) { ... val data = dao.getElements() } I want to get all the Person s, possibly as a list. How do I do this? I don't understand how DataSource.Factory<Int, Person> works. 回答1: According to the docs: Typically, your UI code

Stop reloading previous fragment by using Navigation architecure

坚强是说给别人听的谎言 提交于 2019-12-11 06:14:14
问题 How can we stop reload previous fragment from current fragment by pressing back button Ex. As if we are moving from List-fragment to Details Fragment on back pressed no need to reload List-fragment again by using Android Jet Pack and Navigation Architecture <fragment android:id="@+id/my_nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" app:navGraph="@navigation

Update UI from a Workmanager

别说谁变了你拦得住时间么 提交于 2019-12-11 04:51:47
问题 How do I update the UI from Android WorkManager. Android Workmanager can receive Boolean, Integer, Long, Float, Double, String Documentation says: public Data.Builder putAll (Map<String, Object> values) "Puts all input key-value pairs into the Builder. Valid types are: Boolean, Integer, Long, Float, Double, String, and array versions of each of those types. Invalid types throw an IllegalArgumentException." How do I pass a callback for updating the UI. How to pass POJO without DB call. Result