简体   繁体   中英

How to navigate from fragment to Activity in Android navigation component?

In navigation graph, i have an Activity(MainActivity) which contains 4 fragments. I navigate that fragments using bottomnavigation view through NAV Graph (JetPack Navigation) . I need to play video using Exo Player. So for that reason. i take a fragment which contains recyclerview of videolist. when i pass the intent from VideoListAdapter Class like

             Intent intent=new Intent(context,PlayVideo.class);
             context.startActivity(intent);

for playing full screen video in PlayVideo Actvity

it shows me error of marshal value, & parcel.write.os() , so what have to do?...Please help me.

Since you are using navigation component in your app I suggest that you should use fragments instead of Activity.

A quick fix for your problem would be to hide the bottom navigation view. You can access your bottom navigation using:

BottomNavigationView navBar = getActivity().findViewById(R.id.bottomBar);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM