android-fragments

FCM Data message is not navigating to desired fragment when app is in background

岁酱吖の 提交于 2020-07-10 03:17:25
问题 I have an app with a somewhat complex flow. There is a launcher activity (SplashActivity), then a MainActivity, which has five fragments, then in the fifth fragment, there is the DesiredActivity which has three fragments, one of them being the DesiredFragment. When the app is in foreground and we click on the push notification (data message type), the DesiredFragment opens, no issues there, but when the app is in background, the MainActivity opens, instead of the DesiredFragment, on click of

FCM Data message is not navigating to desired fragment when app is in background

﹥>﹥吖頭↗ 提交于 2020-07-10 03:17:21
问题 I have an app with a somewhat complex flow. There is a launcher activity (SplashActivity), then a MainActivity, which has five fragments, then in the fifth fragment, there is the DesiredActivity which has three fragments, one of them being the DesiredFragment. When the app is in foreground and we click on the push notification (data message type), the DesiredFragment opens, no issues there, but when the app is in background, the MainActivity opens, instead of the DesiredFragment, on click of

PreferenceFragment with transparent background?

风流意气都作罢 提交于 2020-07-06 09:50:39
问题 I have created a PreferenceFragment with two categories and one checkbox, however, when I display it in my app, the background appears to be transparent. I can see the main activities, fields and the PreferenceFragment ones are laid over top of the ones from the main activity...what is the solution to this? In my main activity I am doing this to open the PreferenceFragment when the settings button is selected: @Override public boolean onOptionsItemSelected(MenuItem item) { //handle presses on

PreferenceFragment with transparent background?

冷暖自知 提交于 2020-07-06 09:50:22
问题 I have created a PreferenceFragment with two categories and one checkbox, however, when I display it in my app, the background appears to be transparent. I can see the main activities, fields and the PreferenceFragment ones are laid over top of the ones from the main activity...what is the solution to this? In my main activity I am doing this to open the PreferenceFragment when the settings button is selected: @Override public boolean onOptionsItemSelected(MenuItem item) { //handle presses on

How to observe the livedata with multiple observe for correct way in Android?

杀马特。学长 韩版系。学妹 提交于 2020-07-03 07:27:46
问题 I have an Activity, and it will turn to the fragment-A and then turn to the fragment-B like the following. Activity -> Fragment-A -> Fragment-B situation 1 These two fragment observe the same LiveData for showing snackBar like the following . viewModel.responseData.observe(this, Observer { it.getContentIfNotHandled()?.let { showSnackBar(it) } The livedata in viewModel: var responseData = MutableLiveData<Event<String>>() responseData.value = Event("$message") Error: When I use the above code.

DialogFragment closes when navigating from it to another fragment

荒凉一梦 提交于 2020-06-29 07:22:47
问题 Currently in my navgraph i have dialog fragment destination ( Fragment(dialog) type). When i'm navigating to this dialog and then try to navigate to another fragment from this dialog destination, dialog is closing which in my opinion is upredictable behaviour. Now i'm only navigating to the next fragment like this. findNavController().popBackStack(R.id.testFragment, true) I want to dialog not closing and only navigate to another dialog like a default fragment. How can i achieve this ? 回答1: As

SearchBar with TabLayout and Viewpager. SearchBar (EditText) doesn't filter through users, nor events

北慕城南 提交于 2020-06-29 03:37:06
问题 My SearchFragment is the host Fragment for two other Fragments: SearchUsersFragment and SearchEventsFragment . The way I have it organized is the TabLayout and Viewpager are in the SearchFragment , and the RecyclerView , Adapters , and ArrayList are in the two child Fragments. What I would like to do is implement a SearchBar ( EditText ), which I have already done in the SearchFragment and use that SearchBar to filter through the users (in SearchUsersFragment ) and events (in

How to check/uncheck CheckedTextView (child items) items inside ExpandableListView?

冷暖自知 提交于 2020-06-27 18:35:47
问题 My design : I have created a custom adapter( SignalsExpandableListAdapter) with a CheckedTextView for my ExpandableListView. public class SignalsExpandableListAdapter extends BaseExpandableListAdapter { private Context context; private List<String> listDataHandler; private HashMap<String,List<String>> listHashMap; public SignalsExpandableListAdapter(Context context, List<String> listDataHandler, HashMap<String, List<String>> listHashMap) { this.context = context; this.listDataHandler =

getFragmentManager vs getSupportFragmentManager ERROR

左心房为你撑大大i 提交于 2020-06-27 06:35:11
问题 i need help for this . I realize sth very strange about this. In order to disable the Action bar (Title) , i need to add in this code requestWindowFeature(Window.FEATURE_NO_TITLE); So this only works I change from extends AppCompatActivity To this extends Activity So after changing that, I got error for the getFragmentManager. Please have a look at the screenshot. And let me know if u guys have any idea wads going on? THx 回答1: Use getSupportFragmentManager() instead of getFragmentManager() .

How to pass data between fragments when using bottomNavView

落花浮王杯 提交于 2020-06-26 14:15:36
问题 I have an app with one activity and two fragments, And I navigate using jetpack navigation. In my "Main" fragment, I've a button that trigger function inside the viewModel: edit_text_button.setOnClickListener { homeViewModel.onButtonClicked() } onButtonClicked inside viewModel , basically shuffle the list and trigger observer in main fragment. fun onButtonClicked() { initList = (1..9).shuffled() _list.value = initList } My question is: How can I pass every time the updated list to the second