android-fragments

Object is changed after sending it to another Fragment

回眸只為那壹抹淺笑 提交于 2021-02-11 06:16:48
问题 So, I have a really weird issue, I pass an object from Fragment A to Fragment B , I modify this object in a new instance in Fragment B, but after I change a value on this object it also changes that value when I pop Framgment B and that object keeps modified now also for Fragment A Fragment A ... override fun onItemClick(v: View?, position: Int) { searchView.clearFocus() val bundle = Bundle() bundle.putSerializable("shop", landingAdapter.getItem(position)) findNavController().navigate(R.id

Object is changed after sending it to another Fragment

旧城冷巷雨未停 提交于 2021-02-11 06:16:48
问题 So, I have a really weird issue, I pass an object from Fragment A to Fragment B , I modify this object in a new instance in Fragment B, but after I change a value on this object it also changes that value when I pop Framgment B and that object keeps modified now also for Fragment A Fragment A ... override fun onItemClick(v: View?, position: Int) { searchView.clearFocus() val bundle = Bundle() bundle.putSerializable("shop", landingAdapter.getItem(position)) findNavController().navigate(R.id

Object is changed after sending it to another Fragment

情到浓时终转凉″ 提交于 2021-02-11 06:16:07
问题 So, I have a really weird issue, I pass an object from Fragment A to Fragment B , I modify this object in a new instance in Fragment B, but after I change a value on this object it also changes that value when I pop Framgment B and that object keeps modified now also for Fragment A Fragment A ... override fun onItemClick(v: View?, position: Int) { searchView.clearFocus() val bundle = Bundle() bundle.putSerializable("shop", landingAdapter.getItem(position)) findNavController().navigate(R.id

Fragment save view state

大兔子大兔子 提交于 2021-02-10 19:56:26
问题 I have some Fragment with this structure: <RelativeLayout android:id="@+id/control_panel" android:visibility="gone"> <RelativeLayout android:id="@+id/control_panel_icon"> <ImageView android:id="@+id/control_panel_icon_1" android:src="@drawable/ic_control_panel_icon_1" /> <ImageView android:id="@+id/control_panel_icon_2" android:src="@drawable/ic_control_panel_icon_2" android:visibility="gone"/> </RelativeLayout> <TextView android:id="@+id/control_panel_tv" android:text="@string/not_available"

Unable to instantiate fragment could not find Fragment constructor android

对着背影说爱祢 提交于 2021-02-10 15:45:54
问题 I am having this following error. I added constructor on DailyVerseFragment. But still it doesn't work. I am having this issues for more than one week. Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{com.donghyouny.biblecard/com.donghyouny.biblecard.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.donghyouny.biblecard.DailyVerseFragment: could not find Fragment constructor package com.donghyouny

Unable to instantiate fragment could not find Fragment constructor android

╄→гoц情女王★ 提交于 2021-02-10 15:43:26
问题 I am having this following error. I added constructor on DailyVerseFragment. But still it doesn't work. I am having this issues for more than one week. Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{com.donghyouny.biblecard/com.donghyouny.biblecard.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.donghyouny.biblecard.DailyVerseFragment: could not find Fragment constructor package com.donghyouny

Can't open a fragment from another fragment

情到浓时终转凉″ 提交于 2021-02-10 15:10:32
问题 I have 5 fragments (home, settings, newPost, notifications and profile) inside my Main2Activity . Inside HomeFragment I have a RecyclerView with a lot of post views, every post containing a "open" button which should open a PostFragment . The problem is, I can only use setOnClickListener in RecyclerViewAdapter class, in populateItemRows() method, so when I can't use getActivity() .. HomeFragment: public class HomeFragment extends Fragment{ private RecyclerView recyclerView; private

Difference between calling getActivity().startActivity(); and startActivity(); inside Fragment

眉间皱痕 提交于 2021-02-10 09:53:27
问题 start Activity from inside a Fragment can be done with both codes : startActivity(Intent); getActivity().startActivity(); what is the difference ?? Note : I know the difference when it becomes to startActivityForResult(); so please don't post any thing relates to this method. Thanks 回答1: Nothing. The Fragment docs are pretty clear on this: public void startActivity (Intent intent) Call startActivity(Intent) from the fragment's containing Activity. 回答2: The biggest difference: Fragment

kotlin-cant replace Fragment from RecyclerView adapter

血红的双手。 提交于 2021-02-10 06:35:11
问题 I get Application terminated after click and I don't know where I must type the order of click in adapter or in fragment of RecyclerView Mainadapter.kt class ContentAdapter( private val activity: MainActivity, private var listOfData: ArrayList<MainMarketTickClass> ) : RecyclerView.Adapter<ContentAdapter.ViewHolder>(), View.OnClickListener { override fun onClick(v: View?) { val manager = activity.supportFragmentManager val transaction = manager.beginTransaction() val trs = AddCar() transaction

Fragment not getting accessibility focus after replace

…衆ロ難τιáo~ 提交于 2021-02-10 06:31:31
问题 I have an activity that has a fragment. That fragment gets the accessibility focus correctly. But when a replace the first fragment with another one, the second one is not getting the focuse automatically, I have to touch the fragment to get the focus. This is the way a do the replace: val fragmentTransaction = supportFragmentManager.beginTransaction() fragmentTransaction.replace(R.id.container, myFragment) fragmentTransaction.commit() container.sendAccessibilityEvent(AccessibilityEvent.TYPE