0

Send bundle from itemClickListener of Recyclerview in Activity like this

    val bundle = Bundle()
    bundle.putParcelableArrayList("myPlace", ArrayList<MyPlace>(myPlace))
    ScheduleListFragment().arguments = bundle
    Log.d("번들",bundle.toString())
    finish()

and receive bundle in fragment like this

val bundle = arguments?.getParcelableArrayList<MyPlace>("myPlace")
if(bundle != null){
val yourPlace = requireArguments().getParcelableArrayList<MyPlace>("myPlace")
Log.d("마이", yourPlace.toString())
        }

It says bundle is null...

DeePanShu
  • 1,236
  • 10
  • 23
  • I don't see you doing anything with your ScheduleListFragment that you instantiated and set the arguments on. I don't see how it's possible for you to check if it got its bundle if you never performed a Fragment Transaction with it. – Tenfour04 Jan 25 '22 at 14:18
  • the activity is activated by fragment, so i didnt use transaction – shjung53 Jan 26 '22 at 06:27
  • i solve this with registerForActivityResult! – shjung53 Jan 26 '22 at 15:08

0 Answers0