android-savedstate Questions

3

Solved

I have an activity which holds and shows multiple fragments. When i re-enter the fragment it auto fills text in all the editTexts. The same text for all fields as well. Example: Open fragment a...

2

Solved

I have a screen that loads a bunch of requests and collects some data from the user on the same screen and an external WebView. Therefore, I have a ViewModel that contains these complex request obj...

0

I want to pass some data using savedStateHandle from activity straight to fragment's viewModel. In my activity I have: navController.addOnDestinationChangedListener { controller, _, _ -> contro...

4

Solved

As shown in https://stackoverflow.com/a/61166665/3286489, we could save LiveData in savedStateHandle. I could do that easily https://stackoverflow.com/a/61166665/3286489 private val textLiveData:...

1

Solved

I have an ActionBar menu icon that opens a CategoryFragment. This fragment takes in a category object SafeArgs argument passed from another fragment. In the CategoryFragment, I store the category's...

3

Solved

I'm using lifecycle version 2.2.0-rc03 and the official docs and articles found don't even list the correct class name or constructor arguments. I think I have to get the ViewModel instance through...
Shaum asked 11/1, 2020 at 20:47

1

In referring to https://developer.android.com/reference/androidx/lifecycle/SavedStateHandle#getLiveData(java.lang.String,%20T) The sample codes in Java as below. String defaultValue = ...; // nu...

0

I have two classes AdminPinActivity.kt and AdminPinActivityPresenter.kt AdminPinActivity.kt: class AdminPinActivity : InjectableAppCompatActivity() { @Inject lateinit var adminPinActivityPrese...

5

What is the significance of: super.onCreate(null); instead of super.onCreate(savedInstanceState); With this change, I am able to avoid many problems that otherwise plague my Activitys each ti...

3

I am seeing the following error in my Android crash reports: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: android.support.v7.widget.Toolbar$SavedState at android....
Originative asked 4/5, 2015 at 11:11

3

Solved

I'm attempting to perform a fragment transaction after requesting permissions in Android - however the app continually crashes. How might this code be changed in order to avoid this? Any assistan...

8

Solved

I sometimes see the following stacktrace for a commit that can happen when the user isn't looking at the activity (after state's been saved): java.lang.IllegalStateException: Can not perform this ...

2

Solved

I am a beginner with Android. In Android, some generic elements can be automatically saved/restored in onSaveInstanceState/onRestoreInstanceState. For example, an EditText saves/restores the Text...
Agretha asked 25/7, 2017 at 22:3

2

I have a custom view, let's say this is its code: public class CustomView extends View { boolean visible; boolean enabled; public CustomView(Context context, @Nullable AttributeSet attrs, int...
Cheesecloth asked 17/4, 2017 at 20:57

2

Solved

I'm developing some application and I have one problem. I have : 1. Activity A (Navigation Drawer pattern) with ListFragment in FrameLayout: xml: <FrameLayout ...> </FrameLayout&gt...
1

© 2022 - 2024 — McMap. All rights reserved.