Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

YouTubeActivity Back Navigation Problem

$
0
0

Hii Developers,
I am developing YouTube player, while player running i want to close the player(using built back button or up back button) and need to open last fragment.
YouTube Player

    protected override void OnCreate(Bundle bundle)
            {
                base.OnCreate(bundle);
                // Set our view from the "main" layout resource

                SetContentView(Resource.Layout.youtubeactivity_layout);

                YouTubePlayerView youTubeView = FindViewById<YouTubePlayerView>(Resource.Id.youtube_view);
                youTubeView.Initialize("AIzaSyAQ9UQpJFUVHwk6ipyZ1Su0XvXzM7Oq-_4", this);

                this._videoUrl = Intent.GetStringExtra("videoid");

                var btnBack = FindViewById<Button>(Resource.Id.btnlogoBack);
                btnBack.Click += (s, e) =>
                {
                    Finish();
                };
            }

YouTube Player starting from Expandable List child view(class is: ExpandableListViewAdapter.cs)

     case "video":
                                    Intent intents = new Intent(Application.Context, typeof(YoutubeActivity));
                                    intents.PutExtra("videoid", contList.ContentUrl);
                                    this._activity.StartActivity(intents);

                                    break;


The above image is Expandable List.

The above image is YouTube Player.
when i press beck button up or mobile back, YouTube player restart it wont close.
Code for closing player in YouTubeActivity(calling up back button)

var btnBack = FindViewById<Button>(Resource.Id.btnlogoBack);
                btnBack.Click += (s, e) =>
                {
                    Finish();
                };

Code for mobile back button

 public override void OnBackPressed()
        {
            base.OnBackPressed();
        }

Note:
Here YouTube player starting from expandableListAdapter class that's why i am getting issue. When i start YouTube from activity it's back navigation working fine.
please help to solve this nightmare. :)


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>