android-fragments

Android Kotlin get data from a clicked item in Recyclerview and pass it between fragments

╄→尐↘猪︶ㄣ 提交于 2020-06-17 09:11:46
问题 So I have two data classes ( OutletListDataClass and ProductListDataClass ) that are currently used by two different fragments ( OutletListFragment.kt and ProductListFragment.kt , directly connected in navigation graph.). Both of there fragments are RecyclerView. I want to extract the information from clicked item in OutletListFragment.kt (That contained in the two data classes) and pass it to ProductListFragment.kt . These are the data classes I use in both fragments: OutletListDataClass

Android Kotlin get data from a clicked item in Recyclerview and pass it between fragments

帅比萌擦擦* 提交于 2020-06-17 09:10:45
问题 So I have two data classes ( OutletListDataClass and ProductListDataClass ) that are currently used by two different fragments ( OutletListFragment.kt and ProductListFragment.kt , directly connected in navigation graph.). Both of there fragments are RecyclerView. I want to extract the information from clicked item in OutletListFragment.kt (That contained in the two data classes) and pass it to ProductListFragment.kt . These are the data classes I use in both fragments: OutletListDataClass

Runnable Handler not executing inside fragment. Could not start a runnable

大城市里の小女人 提交于 2020-06-17 07:54:29
问题 I have a runnable inside a fragment. The runnable is meant to update the textviews as well as receive input using buttons. But the program does not enter even once inside the runnable. Please help. What am I doing wrong. Thanks. The code is as follows. I have buttons and textviews inside the runnable. public class TodayFragment extends Fragment { //initialisations @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //UI initialisations

Android fragment can't read bundle. Bundle is always NULL

自作多情 提交于 2020-06-17 05:07:01
问题 I wrote a custom static method to create my fragment. Fragment is a subclass of android.support.v4.app.Fragment class. Method to create my fragment is bellow. public static AddItemFragment newInstance(UUID listId, UUID itemId){ AddItemFragment fragment=new AddItemFragment(); Bundle bundle=new Bundle(); bundle.putSerializable(EXTRA_DATA_LIST_ID,listId); bundle.putSerializable(EXTRA_DATA_ITEM_ID, itemId); fragment.setArguments(bundle); return fragment; } In my onCreate method, I am attempting

Android fragment can't read bundle. Bundle is always NULL

僤鯓⒐⒋嵵緔 提交于 2020-06-17 05:06:56
问题 I wrote a custom static method to create my fragment. Fragment is a subclass of android.support.v4.app.Fragment class. Method to create my fragment is bellow. public static AddItemFragment newInstance(UUID listId, UUID itemId){ AddItemFragment fragment=new AddItemFragment(); Bundle bundle=new Bundle(); bundle.putSerializable(EXTRA_DATA_LIST_ID,listId); bundle.putSerializable(EXTRA_DATA_ITEM_ID, itemId); fragment.setArguments(bundle); return fragment; } In my onCreate method, I am attempting

Null NavHostFragment/NavController with FragmentContainerView

匆匆过客 提交于 2020-06-16 20:02:01
问题 Expected Create bottom app bar navigation using Navigation UI's BottomNavigationView and FragmentContainerView similar to the sample app NavigationAdavancedSample . Note, NavigationAndvancedSample app does not appear to use the same implementation as described in the documentation as it has a workaround implementation using the custom extension method setupWithNavController . Observed Null NavHostFragment when creating the BottomNavigationView in the MainActivity.kt with a

Null NavHostFragment/NavController with FragmentContainerView

不羁岁月 提交于 2020-06-16 19:57:09
问题 Expected Create bottom app bar navigation using Navigation UI's BottomNavigationView and FragmentContainerView similar to the sample app NavigationAdavancedSample . Note, NavigationAndvancedSample app does not appear to use the same implementation as described in the documentation as it has a workaround implementation using the custom extension method setupWithNavController . Observed Null NavHostFragment when creating the BottomNavigationView in the MainActivity.kt with a

Clicking on item of Navigation Drawer doesn’t open fragments

Deadly 提交于 2020-06-16 07:25:11
问题 I want to use the default Navigation Drawer Activity of Android Studio (v. 3.5). After creating this default activity (New Project --> Navigation Drawer Activity) I started this templet. If I click on one of the icons of the navigation menu (e.g. “Gallery”) the current fragment of the NavHost doesn’t change. As I understand the following section: https://developer.android.com/guide/navigation/navigation-ui#Tie-navdrawer the NavController should navigate to the chosen destination if the id of

android fragment android.support.v4.app.fragment crashing the app

醉酒当歌 提交于 2020-06-16 07:24:13
问题 i have been debugging for days, not sure what is causing the issue. here is my basic setup 1. using android 4.1 sdk 2. want to use fragment, but also need to support older devices, so i am using android.support.v4.* here is my only activity MyActivity.java package com.example; import android.os.Bundle; import android.support.v4.app.FragmentActivity; public class MyActivity extends FragmentActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState caused by launchFragmentInContainer

六月ゝ 毕业季﹏ 提交于 2020-06-12 05:39:26
问题 I am trying to test the app workflow. The navigation component has been used to define the app workflow. Have used FragmentScenario for testing the navigation from one fragment to another based on this reference(https://developer.android.com/guide/navigation/navigation-testing). Have added the following dependency in build.gradle debugImplementation("androidx.fragment:fragment-testing:1.1.0-beta01") { exclude group: 'androidx.test', module: 'core' } for accessing the api