{"action":"created","issue":{"url":"https://api.github.com/repos/xamarin/monodroid-samples/issues/59","repository_url":"https://api.github.com/repos/xamarin/monodroid-samples","labels_url":"https://api.github.com/repos/xamarin/monodroid-samples/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/xamarin/monodroid-samples/issues/59/comments","events_url":"https://api.github.com/repos/xamarin/monodroid-samples/issues/59/events","html_url":"https://github.com/xamarin/monodroid-samples/issues/59","id":36261351,"number":59,"title":"ActionBarViewPager sample throws exception when orientation is changed","user":{"login":"rjygraham","id":744982,"avatar_url":"https://avatars.githubusercontent.com/u/744982?v=3","gravatar_id":"","url":"https://api.github.com/users/rjygraham","html_url":"https://github.com/rjygraham","followers_url":"https://api.github.com/users/rjygraham/followers","following_url":"https://api.github.com/users/rjygraham/following{/other_user}","gists_url":"https://api.github.com/users/rjygraham/gists{/gist_id}","starred_url":"https://api.github.com/users/rjygraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjygraham/subscriptions","organizations_url":"https://api.github.com/users/rjygraham/orgs","repos_url":"https://api.github.com/users/rjygraham/repos","events_url":"https://api.github.com/users/rjygraham/events{/privacy}","received_events_url":"https://api.github.com/users/rjygraham/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2014-06-23T04:19:50Z","updated_at":"2016-06-28T18:24:08Z","closed_at":null,"body":"While running the ActionBarViewPager  (HelloSwipeViewWithTabs) sample an exception is thrown when the orientation is changed.\r\n\r\nThe issue occurs `base.OnCreate(bundle);` is executed when Activity1 is recreated due to the orientation change:\r\n```C#\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing Android.App;\r\nusing Android.Content;\r\nusing Android.Runtime;\r\nusing Android.Views;\r\nusing Android.Widget;\r\nusing Android.OS;\r\nusing Android.Support.V4.View;\r\nusing Android.Support.V4.App;\r\n\r\nnamespace HelloSwipeViewWithTabs\r\n{\r\n    [Activity(Label = \"HelloSwipeViewWithTabs\", MainLauncher = true, Icon = \"@drawable/icon\")]\r\n    public class Activity1 : FragmentActivity\r\n    {\r\n        protected override void OnCreate(Bundle bundle)\r\n        {\r\n            base.OnCreate(bundle);\r\n\r\n            // Set our view from the \"main\" layout resource\r\n            SetContentView(Resource.Layout.Main);\r\n            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;\r\n\r\n            var pager = FindViewById<ViewPager>(Resource.Id.pager);\r\n            var adaptor = new GenericFragmentPagerAdaptor(SupportFragmentManager);\r\n\r\n            adaptor.AddFragmentView((i, v, b) =>\r\n            {\r\n                var view = i.Inflate(Resource.Layout.tab, v, false);\r\n                var sampleTextView = view.FindViewById<TextView>(Resource.Id.textView1);\r\n                sampleTextView.Text = \"This is content\";\r\n                return view;\r\n            }\r\n            );\r\n\r\n            adaptor.AddFragmentView((i, v, b) =>\r\n            {\r\n                var view = i.Inflate(Resource.Layout.tab, v, false);\r\n                var sampleTextView = view.FindViewById<TextView>(Resource.Id.textView1);\r\n                sampleTextView.Text = \"This is more content\";\r\n                return view;\r\n            }\r\n            );\r\n\r\n            pager.Adapter = adaptor;\r\n            pager.SetOnPageChangeListener(new ViewPageListenerForActionBar(ActionBar));\r\n\r\n            ActionBar.AddTab(pager.GetViewPageTab(ActionBar, \"Tab1\"));\r\n            ActionBar.AddTab(pager.GetViewPageTab(ActionBar, \"Tab2\"));\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nI've based a portion of an app I'm currently developing on this sample and although my app doesn't require landscape orientation, I'd still like to understand why this is throwing and the proper way to avoid it..."},"comment":{"url":"https://api.github.com/repos/xamarin/monodroid-samples/issues/comments/229138009","html_url":"https://github.com/xamarin/monodroid-samples/issues/59#issuecomment-229138009","issue_url":"https://api.github.com/repos/xamarin/monodroid-samples/issues/59","id":229138009,"user":{"login":"Abhishekk360","id":9945865,"avatar_url":"https://avatars.githubusercontent.com/u/9945865?v=3","gravatar_id":"","url":"https://api.github.com/users/Abhishekk360","html_url":"https://github.com/Abhishekk360","followers_url":"https://api.github.com/users/Abhishekk360/followers","following_url":"https://api.github.com/users/Abhishekk360/following{/other_user}","gists_url":"https://api.github.com/users/Abhishekk360/gists{/gist_id}","starred_url":"https://api.github.com/users/Abhishekk360/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Abhishekk360/subscriptions","organizations_url":"https://api.github.com/users/Abhishekk360/orgs","repos_url":"https://api.github.com/users/Abhishekk360/repos","events_url":"https://api.github.com/users/Abhishekk360/events{/privacy}","received_events_url":"https://api.github.com/users/Abhishekk360/received_events","type":"User","site_admin":false},"created_at":"2016-06-28T18:24:08Z","updated_at":"2016-06-28T18:24:08Z","body":"Thanks for reporting this issue. This issue is fixed on latest updated sample. \r\nHence closing this issue.\r\n\r\nThanks!"}}
{"actor":{"display_login":"Abhishekk360"}}