[{"data":1,"prerenderedAt":3110},["ShallowReactive",2],{"tag-xamarin":3},{"tag":4,"articles":24},{"id":5,"title":6,"body":7,"description":14,"extension":15,"img":16,"meta":17,"name":18,"navigation":19,"path":20,"seo":21,"stem":22,"__hash__":23},"tags\u002Ftags\u002Fxamarin.md","Xamarin",{"type":8,"value":9,"toc":10},"minimark",[],{"title":11,"searchDepth":12,"depth":12,"links":13},"",2,[],"Xamarin is an open-source platform for building modern and performant applications for iOS, Android, and Windows with . NET. Xamarin is an abstraction layer that manages communication of shared code with underlying platform code.","md","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"xamarin",true,"\u002Ftags\u002Fxamarin",{"description":14},"tags\u002Fxamarin","deVB66I7cJMtWvqybFh5POf9LBCBwHNe-5ZGMOzV5G4",[25,251,339,436,532,742,791,871,960,1190,1227,1266,1346,1528,2089,2230,2287,2368,2441,2499,2762,3012],{"id":26,"title":27,"author":28,"body":29,"createdAt":242,"description":243,"extension":15,"img":244,"meta":245,"navigation":19,"path":246,"seo":247,"stem":248,"tags":249,"updatedAt":242,"__hash__":250},"articles\u002Farticles\u002Fxamarin-android-platform-version-support.md","Xamarin Android - Platform Version Support","[object Object]",{"type":8,"value":30,"toc":240},[31,39,49,55,58,98,101,116,124,135,175,177,196,215,220,223,228,233,236],[32,33,34,35,38],"p",{},"So version support and Android is confusing.  Let’s just get the straight.",[36,37],"br",{},"\nIn writing this post I have read things over multiple times.  Do not get discouraged.  Google generally gives three names to the API levels: an API number\u002Finteger, a version number, and a candy name.",[32,40,41,42,48],{},"This is documented on their\n",[43,44,47],"a",{"href":45,"target":46},"http:\u002F\u002Fdeveloper.android.com\u002Fabout\u002Fdashboards\u002Findex.html","_blank","platform dashboard",".  For example KitKat API 19, Version 4.4\n. While working with Xamarin Android, project properties show the following selections.  We have Compile using version, Minimum Android to target\nand Target Android version. Ugh.",[32,50,51],{},[52,53],"img",{"alt":11,"src":54},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-platform-version-suppo_db82-image_2.png",[32,56,57],{},"These values are pushed to the AndroidManifest.xml which is included in your project.",[59,60,64],"pre",{"className":61,"code":62,"language":63,"meta":11,"style":11},"language-xml shiki shiki-themes github-light github-dark","\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003Cmanifest xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\" android:versionCode=\"1\" android:versionName=\"1.0\" package=\"DrawerLayout_V7_Tutorial.DrawerLayout_V7_Tutorial\">  \n    \u003Cuses-sdk android:minSdkVersion=\"19\" android:targetSdkVersion=\"19\" \u002F>  \n    \u003Capplication android:label=\"DrawerLayout_V7_Tutorial\">\u003C\u002Fapplication>  \n\u003C\u002Fmanifest>\n","xml",[65,66,67,75,80,86,92],"code",{"__ignoreMap":11},[68,69,72],"span",{"class":70,"line":71},"line",1,[68,73,74],{},"\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n",[68,76,77],{"class":70,"line":12},[68,78,79],{},"\u003Cmanifest xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\" android:versionCode=\"1\" android:versionName=\"1.0\" package=\"DrawerLayout_V7_Tutorial.DrawerLayout_V7_Tutorial\">  \n",[68,81,83],{"class":70,"line":82},3,[68,84,85],{},"    \u003Cuses-sdk android:minSdkVersion=\"19\" android:targetSdkVersion=\"19\" \u002F>  \n",[68,87,89],{"class":70,"line":88},4,[68,90,91],{},"    \u003Capplication android:label=\"DrawerLayout_V7_Tutorial\">\u003C\u002Fapplication>  \n",[68,93,95],{"class":70,"line":94},5,[68,96,97],{},"\u003C\u002Fmanifest>\n",[32,99,100],{},"While the latest versions of Android often provide great APIs for your app, you should\u002Fneed to continue to support older versions of Android until devices\nget updated.",[32,102,103,104,107,108,110,111,115],{},"The Android ",[43,105,106],{"href":45,"target":46},"Platform Versions"," page\nhas details of version and respective codename\u002FAPI level.  Also of interest is the distribution % for each version.  At the time of this post,\ninterestingly KitKat version 4.4 (API 19) has the largest distribution.",[36,109],{},"\nIn order to use several recent platform API’s on an older version device\u002Fplatform Android\u002FXamarin provide what is called\n",[43,112,114],{"href":113,"target":46},"https:\u002F\u002Fdeveloper.android.com\u002Ftools\u002Fsupport-library\u002Findex.html","support libraries",".",[32,117,118,119,123],{},"The Android Support Library package is a ",[120,121,122],"strong",{},"set of code libraries that provide backward-compatible versions of Android framework APIs","\nas well as features that are only available through the library APIs.  Each support library is backward-compatible to a specific Android API level.",[32,125,126,127,129,130,134],{},"This means that your application can use the libraries features and still be compatible with devices running older API levels.  These support libraries are included in your project and help your application run efficiently on older platforms.  Support Libraries each target a base Android API level and each provides a different set of features. In order to effectively use the libraries, it is important to consider what features you want to support and understand what features are\nsupported by each library at what Android API level.",[36,128],{},"\nBased on Android ",[43,131,133],{"href":132,"target":46},"https:\u002F\u002Fdeveloper.android.com\u002Ftools\u002Fsupport-library\u002Ffeatures.html","Support Library Features","  -",[32,136,137,141,147,150,156,159,161,162,165,166,168,171],{},[138,139,140],"em",{},"In general, we recommend including the ",[43,142,144],{"href":143},"https:\u002F\u002Fdeveloper.android.com\u002Ftools\u002Fsupport-library\u002Ffeatures.html#v4",[138,145,146],{},"v4 support",[138,148,149],{}," and ",[43,151,153],{"href":152},"https:\u002F\u002Fdeveloper.android.com\u002Ftools\u002Fsupport-library\u002Ffeatures.html#v7-appcompat",[138,154,155],{},"v7 appcompat",[138,157,158],{}," libraries, because they support a wide range of Android versions and provide APIs for recommended user interface patterns.",[36,160],{},"\nIn a recent blog post I am working with ActionBars and Toolbars.  I can ",[43,163,164],{"href":132,"target":46},"see"," v7 appcompat library adds support for the ActionBar user interface design patter.  v7 appcompat also includes support for material design implementations.  Now looking at the Toolbar is implemented in API level 21 or higher.  I do want my code to run on KitKat (version 4.4) API level 19.  Toolbar minimum is API 21 which is version 5 (Lollipop).  So how do I setup my above minSdkVersion and targetSdkVersion?",[36,167],{},[120,169,170],{},"Compile using Android version: ",[172,173,174],"u",{},"Set to the version that has all the features you need.",[172,176],{},[32,178,179,181,184,185,188,189,192,195],{},[172,180],{},[120,182,183],{},"Minimum Android to Target – ","android:minSdkVersion : Specifies the minimum API Level on which the application is able to ",[120,186,187],{},"run",". The default value is \"1\".  Note: the Android system will prevent the user from installing the application if the system's API Level is lower than the value specified in this attribute.  ",[172,190,191],{},"Set to the lowest version you want to support.\n",[120,193,194],{},"\nTarget Android version ","- android:targetSdkVersion :",[32,197,198,199,203,204,207,211,212],{},"To allow your app to take advantage of these changes and ensure that your app fits the\nstyle of each user's device, you should set the ",[43,200,202],{"href":201},"https:\u002F\u002Fdeveloper.android.com\u002Fguide\u002Ftopics\u002Fmanifest\u002Fuses-sdk-element.html#target","targetSdkVersion"," value to match the latest Android version available (If not set, the default value equals that given to minSdkVersion).  This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version. The application is still able to run on older versions (down to minSdkVersion).  This does get a little confusing but bottom line ",[138,205,206],{},"To maintain your application along with each Android release, you should increase the value of this attribute to match the latest API level, then thoroughly test your application on the corresponding platform version.  ",[43,208,210],{"href":209,"target":46},"http:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F4568267\u002Fandroid-min-sdk-version-vs-target-sdk-version\u002F4994039#","Stack Overflow had a good definition",":  With this attribute set, the application says that it is able to run on older versions (down to minSdkVersion), but was explicitly tested to work with the version specified here. Specifying this target version allows the platform to disable compatibility settings that are not required for the target version (which may otherwise be turned on in order to maintain forward-compatibility) or enable newer features that are not available to older applications. This does not mean that you can program different features for different versions of the platform—it simply informs the platform that you have tested against the target version and the platform should not perform any extra work to maintain forward-compatibility with the target version. ",[172,213,214],{},"Set to Use Compile using SDK version.",[32,216,217],{},[52,218],{"alt":11,"src":219},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-platform-version-suppo_db82-image_4.png",[32,221,222],{},"Note: In Xamarin Studio the above choices appear slightly different.  Within XS, Project Options – General shows Target framework, then also Project Options – Android Application (2nd screenshot below)",[32,224,225],{},[52,226],{"alt":11,"src":227},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-platform-version-suppo_db82-image_6.png",[32,229,230],{},[52,231],{"alt":11,"src":232},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-platform-version-suppo_db82-image_8.png",[32,234,235],{},"Target framework: Compile using Android version\nMinimum Android version: is the same as Minimum Android to target\nTarget Android version:is the same as Target Android version",[237,238,239],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":11,"searchDepth":12,"depth":12,"links":241},[],"2020-06-11T20:28:49.852Z","Version support and Android is confusing.","\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-platform-version-suppo_db82-image_thumb.png",{},"\u002Farticles\u002Fxamarin-android-platform-version-support",{"title":27,"description":243},"articles\u002Fxamarin-android-platform-version-support",[18],"lGFnwKJcW4IOUUQJPuEloQRzzxk8T48RzHX_sw9r3kc",{"id":252,"title":253,"author":254,"body":255,"createdAt":331,"description":332,"extension":15,"img":275,"meta":333,"navigation":19,"path":334,"seo":335,"stem":336,"tags":337,"updatedAt":331,"__hash__":338},"articles\u002Farticles\u002Fxamarin-android-device-manager-diskdatapartitionsize.md","Xamarin Android Device Manager, disk.dataPartition.size",null,{"type":8,"value":256,"toc":329},[257,260,266,279,302,305,316,319],[32,258,259],{},"Changing the size of emulator memory as a result of INSTALL_FAILED_INSUFFICIENT_STORAGE error message.",[32,261,262,263,265],{},"Step 1 Edit Configuration files",[36,264],{},"\nLocate the configuration files by opening the directory for the particular emulator.  Ensure that the emulator is stopped before proceeding.",[32,267,268],{},[43,269,271],{"href":270},"\u002Farticles\u002Fimages\u002Fimage_636635510284638219.png",[52,272],{"style":273,"title":274,"src":275,"alt":274,"width":276,"height":277,"border":278},"margin: 0px; display: inline; background-image: none;","image","\u002Farticles\u002Fimages\u002Fimage_thumb_636635510288324866.png",321,160,0,[280,281,282,290,293,296],"ul",{},[283,284,285,286,289],"li",{},"Edit ",[120,287,288],{},"hardware-qemu.ini"," file",[283,291,292],{},"Before disk.dataPartition.size = 550m",[283,294,295],{},"After disk.dataPartition.size = 8192m",[283,297,285,298,301],{},[120,299,300],{},"config.ini"," (change to the following) disk.dataPartition.size=8192M",[32,303,304],{},"Step 2 Factory Reset the emulator before booting the emulator, start up.",[32,306,307],{},[43,308,310],{"href":309},"\u002Farticles\u002Fimages\u002Fimage_636635510293311055.png",[52,311],{"style":312,"title":274,"src":313,"alt":274,"width":314,"height":315,"border":278},"display: inline; background-image: none;","\u002Farticles\u002Fimages\u002Fimage_thumb_636635510296662287.png",336,164,[32,317,318],{},"Step 3 Start up emulator and take a look at storage now.",[32,320,321],{},[43,322,324],{"href":323},"\u002Farticles\u002Fimages\u002Fimage_636635510300830063.png",[52,325],{"style":312,"title":274,"src":326,"alt":274,"width":327,"height":328,"border":278},"\u002Farticles\u002Fimages\u002Fimage_thumb_636635510304088087.png",181,319,{"title":11,"searchDepth":12,"depth":12,"links":330},[],"2018-06-02T19:33:00.000Z","Changing the size of emulator memory as a result of INSTALL_FAILED_INSUFFICIENT_STORAGE error message.  Using the following information you can resize the memory allocated to particular android emulator.",{},"\u002Farticles\u002Fxamarin-android-device-manager-diskdatapartitionsize",{"title":253,"description":332},"articles\u002Fxamarin-android-device-manager-diskdatapartitionsize",[18],"FQg2AVDtJFEVZK1j13-8ho-HWvJYPApSvpnabHJdVBg",{"id":340,"title":341,"author":254,"body":342,"createdAt":428,"description":429,"extension":15,"img":396,"meta":430,"navigation":19,"path":431,"seo":432,"stem":433,"tags":434,"updatedAt":428,"__hash__":435},"articles\u002Farticles\u002Fforms-master-detail-template.md","Xamarin Forms Master Detail Template",{"type":8,"value":343,"toc":426},[344,347,357,363,377,382,385,388,399,409],[32,345,346],{},"The current Xamarin Forms master detail template is broken. You will get an error like Error CS0101 The namespace 'already contains a definition for",[32,348,349,350,356],{},"The fix..(thank you ",[43,351,355],{"href":352,"target":46,"rel":353},"https:\u002F\u002Fforums.xamarin.com\u002Fprofile\u002F120906\u002FKymPhillpotts.3866",[354],"noopener","Kym Phillpotts",")",[358,359,360],"ol",{},[283,361,362],{},"It would appear, that the added pages have the wrong namespace. So change the namespace on the added pages",[280,364,365,368,371,374],{},[283,366,367],{},"Page1.xaml.cs - change the Namespace to be just MyApp",[283,369,370],{},"Page1Detail.xaml.cs - Change the namespace to be just MyApp",[283,372,373],{},"Page1Master.xaml.cs - Change the namespace to be just MyApp",[283,375,376],{},"Page1MenuItem.cs - Change the namespace to \"MyApp\"",[358,378,379],{"start":12},[283,380,381],{},"I also noticed that in the Page1Master.xaml.cs it is incorrectly referencing the MenuItems.  It says Page1MenuItems = new ObservableCollection...Change that to be justMenuItems = new ObservableCollection...",[32,383,384],{},"No you can go to your App.Xaml.xs and set the Page1 as the master page:",[32,386,387],{},"eg.MainPage = new MyApp.Page1()",[32,389,390],{},[43,391,393],{"href":392},"\u002Farticle\u002Fimages\u002Fopen-live-writer-70a95c1575c8_decb-image_2.png",[52,394],{"style":395,"title":274,"src":396,"alt":274,"width":397,"height":398,"border":278},"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;","\u002Farticles\u002Fimages\u002Fopen-live-writer-70a95c1575c8_decb-image_thumb.png",428,296,[32,400,401,402,405],{},"Reference: ",[43,403],{"title":404,"href":404},"https:\u002F\u002Fforums.xamarin.com\u002Fdiscussion\u002F89346\u002Fforms-master-detail-page-generation-is-broken",[43,406,404],{"href":404,"rel":407},[408],"nofollow",[32,410,411,412,414,417,420,423],{},"Also there are bugs in Bugzilla for both of these:",[36,413],{},[43,415],{"href":416},"https:\u002F\u002Fbugzilla.xamarin.com\u002Fshow_bug.cgi?id=53020",[43,418,416],{"href":416,"rel":419},[408],[43,421],{"href":422},"https:\u002F\u002Fbugzilla.xamarin.com\u002Fshow_bug.cgi?id=53021",[43,424,422],{"href":422,"rel":425},[408],{"title":11,"searchDepth":12,"depth":12,"links":427},[],"2017-03-14T13:20:03.000Z","The current Xamarin Forms master detail template is broken.  You will get an error like Error CS0101 The namespace 'already contains a definition for.",{},"\u002Farticles\u002Fforms-master-detail-template",{"title":341,"description":429},"articles\u002Fforms-master-detail-template",[18],"INsVAI3syQmOBP5U9aqAwo-8SVPG9zLItscvwFjbZ8Y",{"id":437,"title":438,"author":28,"body":439,"createdAt":525,"description":254,"extension":15,"img":451,"meta":526,"navigation":19,"path":527,"seo":528,"stem":529,"tags":530,"updatedAt":525,"__hash__":531},"articles\u002Farticles\u002Fno-ios-simulator-or-device-appear-on-visual-studio.md","No IOS simulator or device appear on Visual Studio",{"type":8,"value":440,"toc":523},[441,454,460,462,474,477,487,503,510,513],[32,442,443],{},[43,444,447],{"style":445,"href":446},"display: none","\u002Farticles\u002Fimages\u002Fopen-live-writer-i_c801-xamarinios_2.png",[52,448],{"title":449,"style":450,"border":278,"alt":449,"src":451,"width":452,"height":453},"xamarinios","border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px","\u002Farticles\u002Fimages\u002Fopen-live-writer-i_c801-xamarinios_thumb.png",147,128,[32,455,456,457],{},"Ok, once again – I open a Xamarin Forms app, ensure I have the latest Xamarin Forms version in each of the PCL, Android and IOS projects. The project rebuild works for the PCL and Android projects and fails for the IOS. The error… ",[138,458,459],{},"No valid iOS code signing keys found in keychain.",[138,461],{},[32,463,464,473],{},[138,465,466,467,470],{},"You need to request a codesigning certificate from\n",[43,468],{"href":469},"https:\u002F\u002Fdeveloper.apple.com",[43,471,469],{"href":469,"rel":472},[408]," What’s going on…I first look to ensure my Mac agent is connected yep, perform a clean and rebuild of each project..same error. The solution for me…. Open the dialog “Xamarin Mac Agent” – right click on the connect Mac – choose ‘Disconnect’. After disconnection – select the Mac and ‘Connect’…waiting (aha …it won’t connect, this could be the problem) Nope – didn’t think it would be this easy. I was able to use the ‘show simulator’ option within vs.net and the simulator popped open on the Mac. I opened another project to see if this issue was related to the specific project. Nope. The 2nd project I opened had the same issue, where in the ‘Device’ list the was no option for ‘iphone simulator’.",[32,475,476],{},"I then proceed to open Xamarin Studio on the Mac (currently I am using the Beta channel as this was necessary to work with Visual Studio 2017). There is an update and it started to download. Here is to more hope that this solves the issue.",[32,478,479],{},[43,480,482],{"href":481},"\u002Farticles\u002Fimages\u002Fopen-live-writer-i_c801-image_2.png",[52,483],{"title":274,"style":484,"border":278,"alt":274,"src":485,"width":486,"height":277},"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px","\u002Farticles\u002Fimages\u002Fopen-live-writer-i_c801-image_thumb.png",229,[32,488,489,490,494,495],{},"This update on the Mac will move it up to ",[43,491,493],{"href":492,"target":46},"https:\u002F\u002Freleases.xamarin.com\u002Frelease-candidate-cycle-9-rc6-refresh\u002F","Xamarin Studio 6.2.0"," I tried to find the IOS Simulator after this update. Still nothing. I removed all mac agents, restarted vs.net 2017 a couple times, still nothing. I opened up another project and magically this time the ‘iphone simulator’ option was available. Why…no idea..(this product is going to kill me)\n",[43,496,498],{"href":497},"\u002Farticles\u002Fimages\u002Fopen-live-writer-i_c801-image_4.png",[52,499],{"title":274,"style":484,"border":278,"alt":274,"src":500,"width":501,"height":502},"\u002Farticles\u002Fimages\u002Fimages\u002Fopen-live-writer-i_c801-image_thumb_1.png",479,36,[32,504,505,506,509],{},"So now I am thinking there is a difference between the 2 projects. Why would I have the simulator option in one but not the other? This is really messed up. So I open the project that does not have the ‘iphonesimulator’ option, I can see within Configuration Manager that this option exists ",[120,507,508],{},"and ","I can connect, build, deploy to Mac simulator.",[32,511,512],{},"Well this scenario is new to me…no idea.",[32,514,515],{},[43,516,518],{"href":517},"\u002Farticles\u002Fimages\u002Fopen-live-writer-i_c801-image_6.png",[52,519],{"title":274,"style":484,"border":278,"alt":274,"src":520,"width":521,"height":522},"\u002Farticles\u002Fimages\u002Fopen-live-writer-i_c801-image_thumb_2.png",240,171,{"title":11,"searchDepth":12,"depth":12,"links":524},[],"2017-02-18T08:07:02.3200000-05:00",{},"\u002Farticles\u002Fno-ios-simulator-or-device-appear-on-visual-studio",{"title":438,"description":254},"articles\u002Fno-ios-simulator-or-device-appear-on-visual-studio",[18],"4n4VwoebArTKwJ97QT4guPzoyBnHAnofJjW9sIKPOVM",{"id":533,"title":534,"author":28,"body":535,"createdAt":734,"description":735,"extension":15,"img":547,"meta":736,"navigation":19,"path":737,"seo":738,"stem":739,"tags":740,"updatedAt":734,"__hash__":741},"articles\u002Farticles\u002Fthe-type-object-is-defined-in-an-assembly-that-is-not-referenced-you-must-add-a-reference-to-assembly-mscorlib-version-2-0-5-0.md","The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0",{"type":8,"value":536,"toc":732},[537,540,550,678,681,684,729],[32,538,539],{},"Another day, another issue while building a Xamarin project. In this case, I was building a project from Xamarin and working through some logic. When building the Android project I was presented with the following build errors. I am getting use to different errors at the most unexpected times. This issue was not unlike others that I have come up against with my cross-device mobile development efforts. The good news, after much hunting and packing I found the solution. See below.",[32,541,542],{},[43,543,545],{"href":544},"\u002Farticles\u002Fimages\u002Fopen-live-writer-6b25ff33673e_d99f-image_5.png",[52,546],{"title":274,"style":484,"border":278,"alt":274,"src":547,"width":548,"height":549},"\u002Farticles\u002Fimages\u002Fopen-live-writer-6b25ff33673e_d99f-image_thumb_1.png",657,458,[59,551,555],{"className":552,"code":553,"language":554,"meta":11,"style":11},"language-html shiki shiki-themes github-light github-dark","Severity Code Description Project File Line Suppression State\nError CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral,\n\nPublicKeyToken=7cec85d7bea7798e'. GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 ActiveError CS0234 The type or namespace name 'TargetFrameworkAttributeAttribute' does not exist in the namespace 'System.Runtime.Versioning' (are you missing an assembly reference?) GreatQuotes.Android\n\nC:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0234 The type or namespace name 'TargetFrameworkAttribute' does not exist in the namespace 'System.Runtime.Versioning' (are you missing an assembly reference?) \nGreatQuotes.Android C:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0518 Predefined type 'System.String' is not defined or imported GreatQuotes.Android C:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0246 The type or namespace name 'FrameworkDisplayName' could not be found (are you missing a using directive or an assembly reference?) GreatQuotes.Android\n\nC:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0518 Predefined type 'System.String' is not defined or imported GreatQuotes.Android C:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0518 Predefined type 'System.Object' \nis not defined or imported \nGreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 Active\nError CS0518 Predefined type 'System.Void' is not defined or imported GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 ActiveError CS0012 The type 'Object' is defined in an assembly that is not referenced. \n\nYou must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 Active\n\nError CS0246 The type or namespace name 'Icon' could not be found (are you missing a using directive or an assembly reference?) GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 ActiveError CS0518 Predefined type 'System.Object' is not defined or imported GreatQuotes.Android \n\nC:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 Active\nError CS0518 Predefined type 'System.String' is not defined or imported GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 \n\nResources\\Start\\GreatQuotes.Android\\App.cs 9 ActiveError CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.\nGreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 Active  \n","html",[65,556,557,563,568,573,578,582,588,594,599,605,611,617,623,628,634,639,645,650,656,662,667,673],{"__ignoreMap":11},[68,558,559],{"class":70,"line":71},[68,560,562],{"class":561},"sVt8B","Severity Code Description Project File Line Suppression State\n",[68,564,565],{"class":70,"line":12},[68,566,567],{"class":561},"Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral,\n",[68,569,570],{"class":70,"line":82},[68,571,572],{"emptyLinePlaceholder":19},"\n",[68,574,575],{"class":70,"line":88},[68,576,577],{"class":561},"PublicKeyToken=7cec85d7bea7798e'. GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 ActiveError CS0234 The type or namespace name 'TargetFrameworkAttributeAttribute' does not exist in the namespace 'System.Runtime.Versioning' (are you missing an assembly reference?) GreatQuotes.Android\n",[68,579,580],{"class":70,"line":94},[68,581,572],{"emptyLinePlaceholder":19},[68,583,585],{"class":70,"line":584},6,[68,586,587],{"class":561},"C:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0234 The type or namespace name 'TargetFrameworkAttribute' does not exist in the namespace 'System.Runtime.Versioning' (are you missing an assembly reference?) \n",[68,589,591],{"class":70,"line":590},7,[68,592,593],{"class":561},"GreatQuotes.Android C:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0518 Predefined type 'System.String' is not defined or imported GreatQuotes.Android C:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0246 The type or namespace name 'FrameworkDisplayName' could not be found (are you missing a using directive or an assembly reference?) GreatQuotes.Android\n",[68,595,597],{"class":70,"line":596},8,[68,598,572],{"emptyLinePlaceholder":19},[68,600,602],{"class":70,"line":601},9,[68,603,604],{"class":561},"C:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0518 Predefined type 'System.String' is not defined or imported GreatQuotes.Android C:\\Users\\dyardy\\AppData\\Local\\Temp\\MonoAndroid,Version=v7.1.AssemblyAttributes.cs 4 ActiveError CS0518 Predefined type 'System.Object' \n",[68,606,608],{"class":70,"line":607},10,[68,609,610],{"class":561},"is not defined or imported \n",[68,612,614],{"class":70,"line":613},11,[68,615,616],{"class":561},"GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 Active\n",[68,618,620],{"class":70,"line":619},12,[68,621,622],{"class":561},"Error CS0518 Predefined type 'System.Void' is not defined or imported GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 ActiveError CS0012 The type 'Object' is defined in an assembly that is not referenced. \n",[68,624,626],{"class":70,"line":625},13,[68,627,572],{"emptyLinePlaceholder":19},[68,629,631],{"class":70,"line":630},14,[68,632,633],{"class":561},"You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 Active\n",[68,635,637],{"class":70,"line":636},15,[68,638,572],{"emptyLinePlaceholder":19},[68,640,642],{"class":70,"line":641},16,[68,643,644],{"class":561},"Error CS0246 The type or namespace name 'Icon' could not be found (are you missing a using directive or an assembly reference?) GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 ActiveError CS0518 Predefined type 'System.Object' is not defined or imported GreatQuotes.Android \n",[68,646,648],{"class":70,"line":647},17,[68,649,572],{"emptyLinePlaceholder":19},[68,651,653],{"class":70,"line":652},18,[68,654,655],{"class":561},"C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 Resources\\Start\\GreatQuotes.Android\\App.cs 9 Active\n",[68,657,659],{"class":70,"line":658},19,[68,660,661],{"class":561},"Error CS0518 Predefined type 'System.String' is not defined or imported GreatQuotes.Android C:\\Xamarin\\10a_xam300\\Lab Materials\\Part 01 \n",[68,663,665],{"class":70,"line":664},20,[68,666,572],{"emptyLinePlaceholder":19},[68,668,670],{"class":70,"line":669},21,[68,671,672],{"class":561},"Resources\\Start\\GreatQuotes.Android\\App.cs 9 ActiveError CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.\n",[68,674,676],{"class":70,"line":675},22,[68,677,616],{"class":561},[32,679,680],{},"The solution (to make a very long story short) was to unload the project from Visual Studio. Open the csproj and add the following reference (in bold). I initially was comparing some of my working Android projects with this one that just would not build.",[32,682,683],{},"I noticed the reference to mscorlib. I tried to add a reference to this dll directly through ‘Add Reference’ but I got the following error \"mscorlib.dll\" component is already automatically referenced. The build system should add this reference for you.  Since I could not add through the VS.NET interface, i chose to add via csproj file. After reloading the project and rebuilding the reference to mscorlib was visible in the list of references and finally my project built fine.",[59,685,687],{"className":61,"code":686,"language":63,"meta":11,"style":11},"\u003CItemGroup> \n    \u003CReference Include=\"Mono.Android\" \u002F>\n    \u003CReference Include=\"mscorlib\" \u002F>\n    \u003CReference Include=\"System\" \u002F> \n    \u003CReference Include=\"System.Xml\" \u002F> \n    \u003CReference Include=\"System.Core\" \u002F> \n    \u003CReference Include=\"System.Xml.Linq\" \u002F>\n\u003C\u002FItemGroup>\n",[65,688,689,694,699,704,709,714,719,724],{"__ignoreMap":11},[68,690,691],{"class":70,"line":71},[68,692,693],{},"\u003CItemGroup> \n",[68,695,696],{"class":70,"line":12},[68,697,698],{},"    \u003CReference Include=\"Mono.Android\" \u002F>\n",[68,700,701],{"class":70,"line":82},[68,702,703],{},"    \u003CReference Include=\"mscorlib\" \u002F>\n",[68,705,706],{"class":70,"line":88},[68,707,708],{},"    \u003CReference Include=\"System\" \u002F> \n",[68,710,711],{"class":70,"line":94},[68,712,713],{},"    \u003CReference Include=\"System.Xml\" \u002F> \n",[68,715,716],{"class":70,"line":584},[68,717,718],{},"    \u003CReference Include=\"System.Core\" \u002F> \n",[68,720,721],{"class":70,"line":590},[68,722,723],{},"    \u003CReference Include=\"System.Xml.Linq\" \u002F>\n",[68,725,726],{"class":70,"line":596},[68,727,728],{},"\u003C\u002FItemGroup>\n",[237,730,731],{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":11,"searchDepth":12,"depth":12,"links":733},[],"2017-02-12T08:38:11.7100000-05:00","This issue was not unlike others that I have come up against with my cross-device mobile development efforts.",{},"\u002Farticles\u002Fthe-type-object-is-defined-in-an-assembly-that-is-not-referenced-you-must-add-a-reference-to-assembly-mscorlib-version-2-0-5-0",{"title":534,"description":735},"articles\u002Fthe-type-object-is-defined-in-an-assembly-that-is-not-referenced-you-must-add-a-reference-to-assembly-mscorlib-version-2-0-5-0",[18],"RHG4SC8nF4gbrv4fVY5o1UgRK9wxXwly9sZS5lhbuJA",{"id":743,"title":744,"author":28,"body":745,"createdAt":784,"description":254,"extension":15,"img":780,"meta":785,"navigation":19,"path":786,"seo":787,"stem":788,"tags":789,"updatedAt":784,"__hash__":790},"articles\u002Farticles\u002Funable-to-start-build-4-3-0-664-agent-when-building-ios-apps.md","Unable to start Build 4.3.0.664 agent. when building iOS apps",{"type":8,"value":746,"toc":782},[747,750,753,756,759,762,765],[32,748,749],{},"Starting up Visual Studio 2017 RC today, opening a Xamarin Forms application and building",[32,751,752],{},"I am presented with…\n“Unable to start Build 4.3.0.664 agent. when building iOS apps”",[32,754,755],{},"Uggh, yes another build issue.  So before I can do anything I must once again work through connectivity, emulator, build errors.  Note, if you venture to go in this direction with your learning\u002Fcareer patience is a must.",[32,757,758],{},"1.) Delete this folder:\nC:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\Xamarin",[32,760,761],{},"2.) Delete this folder:\nC:\\Users{username}\\AppData\\Local\\Microsoft\\VisualStudio\\15.0_3bcaeaa8\n(this hash needs to correspond to the instance of VS 2017 you are using)   I am using 2017 RC.4+26206.0 right now by the way.",[32,763,764],{},"References:",[32,766,767,770,773,774],{},[43,768],{"title":769,"href":769},"https:\u002F\u002Fbugzilla.xamarin.com\u002Fshow_bug.cgi?id=52320",[43,771,769],{"href":769,"rel":772},[408]," ",[43,775,777],{"style":445,"href":776},"\u002Farticles\u002Fimages\u002Fopen-live-writer-f3509fbbd236_cabe-xambear_2.png",[52,778],{"title":779,"style":450,"border":278,"alt":779,"src":780,"width":781,"height":521},"xambear","\u002Farticles\u002Fimages\u002Fopen-live-writer-f3509fbbd236_cabe-xambear_thumb.png",238,{"title":11,"searchDepth":12,"depth":12,"links":783},[],"2017-02-11T07:30:20.2700000-05:00",{},"\u002Farticles\u002Funable-to-start-build-4-3-0-664-agent-when-building-ios-apps",{"title":744,"description":254},"articles\u002Funable-to-start-build-4-3-0-664-agent-when-building-ios-apps",[18],"Bvk7DkjOIcwpBI7iCzu8qpkqzDHOQEEgIXovxsIBVhQ",{"id":792,"title":793,"author":28,"body":794,"createdAt":864,"description":254,"extension":15,"img":803,"meta":865,"navigation":19,"path":866,"seo":867,"stem":868,"tags":869,"updatedAt":864,"__hash__":870},"articles\u002Farticles\u002Fxamarin-unable-to-debug-android-application.md","Xamarin Unable to Debug Android Application",{"type":8,"value":795,"toc":862},[796,804,810,813,823,826,836,844,846,854],[32,797,798],{},[43,799,801],{"style":445,"href":800},"\u002Farticles\u002Fimages\u002Fopen-live-writer-xamarin-unable-to-debug-android-applicat_83e7-xambear_2.png",[52,802],{"title":779,"style":450,"border":278,"alt":779,"src":803,"width":781,"height":521},"\u002Farticles\u002Fimages\u002Fopen-live-writer-xamarin-unable-to-debug-android-applicat_83e7-xambear_thumb.png",[32,805,806,807],{},"Using Visual Studio 2017 and opening small Xamarin forms application, building then debug-run I get the following error in the output window. This occurred while using the Visual Studio Android emulator.\n",[138,808,809],{},"“Android application is debugging.\nCould not connect to the debugger.”",[32,811,812],{},"The solution was to open Hyper-V Manager, find the emulator (ensure that the emulator is shutdown), Settings – Processor then select ‘Migrate to a physical computer…’",[32,814,815],{},[43,816,818],{"href":817},"\u002Farticles\u002Fimages\u002Fopen-live-writer-xamarin-unable-to-debug-android-applicat_83e7-image_2.png",[52,819],{"title":274,"style":450,"border":278,"alt":274,"src":820,"width":821,"height":822},"\u002Farticles\u002Fimages\u002Fopen-live-writer-xamarin-unable-to-debug-android-applicat_83e7-image_thumb.png",326,310,[32,824,825],{},"While this seemed like the complete solution it wasn’t. One of my projects I could debug while the other one I could not. I compared the two csproj files and found this difference.",[32,827,828],{},[43,829,831],{"href":830},"\u002Farticles\u002Fimages\u002Fopen-live-writer-xamarin-unable-to-debug-android-applicat_83e7-image_4.png",[52,832],{"title":274,"style":484,"border":278,"alt":274,"src":833,"width":834,"height":835},"\u002Farticles\u002Fimages\u002Fopen-live-writer-xamarin-unable-to-debug-android-applicat_83e7-image_thumb_1.png",594,47,[32,837,838,839,843],{},"Once I set my project option to ",[840,841,842],"debug-symbols",{},"True"," it worked, and I could F5 Debug the solution\u002Fproject.",[32,845,764],{},[32,847,848,851],{},[43,849],{"title":850,"href":850},"https:\u002F\u002Fdeveloper.xamarin.com\u002Fguides\u002Fandroid\u002Fdeployment,_testing,_and_metrics\u002Fdebug-on-emulator\u002Fvisual-studio-android-emulator\u002F#Troubleshooting",[43,852,850],{"href":850,"rel":853},[408],[32,855,856,859],{},[43,857],{"title":858,"href":858},"http:\u002F\u002Fdotnetbyexample.blogspot.com\u002F2016\u002F02\u002Ffix-for-could-not-connect-to-debugger.html",[43,860,858],{"href":858,"rel":861},[408],{"title":11,"searchDepth":12,"depth":12,"links":863},[],"2017-02-07T02:28:10.7500000-05:00",{},"\u002Farticles\u002Fxamarin-unable-to-debug-android-application",{"title":793,"description":254},"articles\u002Fxamarin-unable-to-debug-android-application",[18],"xEMm429S_KQM-tgQHYtY0p4LQ9fk8AFAFkSktelwbHI",{"id":872,"title":873,"author":28,"body":874,"createdAt":952,"description":953,"extension":15,"img":879,"meta":954,"navigation":19,"path":955,"seo":956,"stem":957,"tags":958,"updatedAt":952,"__hash__":959},"articles\u002Farticles\u002Fvisual-studio-2017-ios-build-debug-error.md","Visual Studio 2017 IOS Build Debug Error",{"type":8,"value":875,"toc":950},[876,882,885,924,927,930,938,948],[52,877],{"title":878,"style":450,"border":278,"alt":878,"src":879,"width":880,"height":881},"xam","\u002Farticles\u002Fimages\u002Fopen-live-writer-visual-studio-2017ios-build-debug-error_c406-xam_thumb.png",132,121,[32,883,884],{},"Ok, I got my Visual Studio Android emulator working, see prior blog post. Now focusing on IOS debug-run with a connected Mac.\nI got the following error..  Severity Code Description Project File Line Suppression State",[59,886,888],{"className":552,"code":887,"language":554,"meta":11,"style":11},"Error Could not copy the assembly '\u002FLibrary\u002FFrameworks\u002FXamarin.iOS.framework\u002FVersions\u002F10.4.0.97\u002Flib\u002Fmono\u002FXamarin.iOS\u002Fmscorlib.dll' to \n'\u002FUsers\u002Fdavidyardy\u002FLibrary\u002FCaches\u002FXamarin\u002Fmtbs\u002Fbuilds\u002FApp1.iOS\u002F820c43b5a93f812c648bedcbb5cd7ad5\u002Fbin\u002FiPhoneSimulator\u002FDebug\u002FApp1.iOS.app\u002F.monotouch-64\u002Fmscorlib.dll': \n\nAccess to the path \n\"\u002FLibrary\u002FFrameworks\u002FXamarin.iOS.framework\u002FVersions\u002F10.4.0.97\u002Flib\u002Fmono\u002FXamarin.iOS\u002Fmscorlib.dll.mdb\" \nor \"\u002FUsers\u002Fdavidyardy\u002FLibrary\u002FCaches\u002FXamarin\u002Fmtbs\u002Fbuilds\u002FApp1.iOS\u002F820c43b5a93f812c648bedcbb5cd7ad5\u002Fbin\u002FiPhoneSimulator\u002FDebug\u002FApp1.iOS.app\u002F.monotouch-64\u002Fmscorlib.dll.mdb\" is denied. \nApp1.iOS   \n",[65,889,890,895,900,904,909,914,919],{"__ignoreMap":11},[68,891,892],{"class":70,"line":71},[68,893,894],{"class":561},"Error Could not copy the assembly '\u002FLibrary\u002FFrameworks\u002FXamarin.iOS.framework\u002FVersions\u002F10.4.0.97\u002Flib\u002Fmono\u002FXamarin.iOS\u002Fmscorlib.dll' to \n",[68,896,897],{"class":70,"line":12},[68,898,899],{"class":561},"'\u002FUsers\u002Fdavidyardy\u002FLibrary\u002FCaches\u002FXamarin\u002Fmtbs\u002Fbuilds\u002FApp1.iOS\u002F820c43b5a93f812c648bedcbb5cd7ad5\u002Fbin\u002FiPhoneSimulator\u002FDebug\u002FApp1.iOS.app\u002F.monotouch-64\u002Fmscorlib.dll': \n",[68,901,902],{"class":70,"line":82},[68,903,572],{"emptyLinePlaceholder":19},[68,905,906],{"class":70,"line":88},[68,907,908],{"class":561},"Access to the path \n",[68,910,911],{"class":70,"line":94},[68,912,913],{"class":561},"\"\u002FLibrary\u002FFrameworks\u002FXamarin.iOS.framework\u002FVersions\u002F10.4.0.97\u002Flib\u002Fmono\u002FXamarin.iOS\u002Fmscorlib.dll.mdb\" \n",[68,915,916],{"class":70,"line":584},[68,917,918],{"class":561},"or \"\u002FUsers\u002Fdavidyardy\u002FLibrary\u002FCaches\u002FXamarin\u002Fmtbs\u002Fbuilds\u002FApp1.iOS\u002F820c43b5a93f812c648bedcbb5cd7ad5\u002Fbin\u002FiPhoneSimulator\u002FDebug\u002FApp1.iOS.app\u002F.monotouch-64\u002Fmscorlib.dll.mdb\" is denied. \n",[68,920,921],{"class":70,"line":590},[68,922,923],{"class":561},"App1.iOS\n",[32,925,926],{},"I made sure that my Mac Agent was connected and all seemed good there. I opened the with Xamarin Studio (on the Mac) and had the exact same error. Ok so this error is not isolated to only Visual Studio (or worse yet just 2017). I now have the problem on both Mac and Windows.",[32,928,929],{},"This could be related to the beta release\u002Fchannel of Xamarin. Ok, so the resolution was found with this bug\u002Fresolution posted here",[32,931,932,935],{},[43,933],{"title":934,"href":934},"https:\u002F\u002Fbugzilla.xamarin.com\u002Fshow_bug.cgi?id=52113",[43,936,934],{"href":934,"rel":937},[408],[32,939,940,941,943,944,947],{},"The full workaround is:",[36,942],{},"\nsudo chmod 0644 \u002FLibrary\u002FFrameworks\u002FXamarin.iOS.framework\u002FVersions\u002FCurrent\u002Flib\u002Fmono\u002F",[138,945,946],{},"\u002F",".mdb",[237,949,731],{},{"title":11,"searchDepth":12,"depth":12,"links":951},[],"2017-02-05T04:02:44.7100000-05:00","Visual Studio and building IOS application",{},"\u002Farticles\u002Fvisual-studio-2017-ios-build-debug-error",{"title":873,"description":953},"articles\u002Fvisual-studio-2017-ios-build-debug-error",[18],"4aE_tqAmn0sxAwUmT9lVPkIatZrjaCo1WRB0ak5dzjA",{"id":961,"title":962,"author":28,"body":963,"createdAt":1182,"description":1183,"extension":15,"img":971,"meta":1184,"navigation":19,"path":1185,"seo":1186,"stem":1187,"tags":1188,"updatedAt":1182,"__hash__":1189},"articles\u002Farticles\u002Fstarting-emulator-for-avd-phone-x86-toolsforapachecordova.md","Starting emulator for AVD 'Phone_x86_ToolsForApacheCordova",{"type":8,"value":964,"toc":1180},[965,972,979,1004,1007,1009,1017,1032,1042,1048,1051,1054,1062,1071,1079,1082,1092,1095,1107,1110,1120,1123,1133,1136,1144,1147,1155,1165,1172,1175,1178],[43,966,969],{"href":967,"style":968},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-xam_2.png","display:none;",[52,970],{"title":878,"style":450,"border":278,"alt":878,"src":971,"width":880,"height":881},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-xam_thumb.png",[32,973,974,975,978],{},"Starting emulator with ",[172,976,977],{},"Visual Studio 2017 RC"," error -",[59,980,982],{"className":552,"code":981,"language":554,"meta":11,"style":11},"“Starting emulator for AVD 'Phone_x86_ToolsForApacheCordova'emulator: \nERROR: x86 emulation currently requires hardware acceleration!Please ensure \nIntel HAXM is properly installed and usable.CPU acceleration status: \nPlease disable Hyper-V before using the Android Emulator. \n",[65,983,984,989,994,999],{"__ignoreMap":11},[68,985,986],{"class":70,"line":71},[68,987,988],{"class":561},"“Starting emulator for AVD 'Phone_x86_ToolsForApacheCordova'emulator: \n",[68,990,991],{"class":70,"line":12},[68,992,993],{"class":561},"ERROR: x86 emulation currently requires hardware acceleration!Please ensure \n",[68,995,996],{"class":70,"line":82},[68,997,998],{"class":561},"Intel HAXM is properly installed and usable.CPU acceleration status: \n",[68,1000,1001],{"class":70,"line":88},[68,1002,1003],{"class":561},"Please disable Hyper-V before using the Android Emulator.\n",[32,1005,1006],{},"Start a command prompt as Administrator, run 'bcdedit \u002Fset hypervisorlaunchtype off', reboot.”",[32,1008,764],{},[32,1010,1011,1014],{},[43,1012],{"title":1013,"href":1013},"http:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F26355645\u002Ferror-in-launching-avd-with-amd-processor",[43,1015,1013],{"href":1013,"rel":1016},[408],[59,1018,1020],{"className":552,"code":1019,"language":554,"meta":11,"style":11},"C:\\Program Files (x86)\\Android\\android-sdk\\extras\\intel\\Hardware_Accelerated_Execution_Manager >intelhaxm-android.exe \nDisable Hyper V - dism.exe \u002FOnline \u002FDisable-Feature:Microsoft-Hyper-V  \n",[65,1021,1022,1027],{"__ignoreMap":11},[68,1023,1024],{"class":70,"line":71},[68,1025,1026],{"class":561},"C:\\Program Files (x86)\\Android\\android-sdk\\extras\\intel\\Hardware_Accelerated_Execution_Manager >intelhaxm-android.exe \n",[68,1028,1029],{"class":70,"line":12},[68,1030,1031],{"class":561},"Disable Hyper V - dism.exe \u002FOnline \u002FDisable-Feature:Microsoft-Hyper-V\n",[32,1033,1034],{},[43,1035,1037],{"href":1036},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_2.png",[52,1038],{"title":274,"style":450,"border":278,"alt":274,"src":1039,"width":1040,"height":1041},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_thumb.png",334,255,[32,1043,1044],{},[43,1045,1047],{"href":1046,"target":46},"http:\u002F\u002Fhttps:\u002F\u002Fsoftware.intel.com\u002Fen-us\u002Fandroid\u002Farticles\u002Finstallation-instructions-for-intel-hardware-accelerated-execution-manager-windows","Installation Instructions for Intel® Hardware Accelerated Execution Manager (Intel® HAXM) - Microsoft Windows*",[32,1049,1050],{},"At this point, I felt that it must have been disabled in my BIOS. Taking another moment I started looking for the Visual Studio Android emulator (this is the one that I had used after Xamarin Player was deprecated. I found that I could start this manually by searching for Visual Studio Emulator for Android.",[32,1052,1053],{},"It would start fine but Visual Studio would not allow me to deploy to it.  I went back to the Visual Studio 2017 installer and then found an individual component “Visual Studio Emulator for Android” that was not installed. I selected and proceeded to install. You can follow these instructions on how to find the 2017 installer",[32,1055,1056,1059],{},[43,1057],{"title":1058,"href":1058},"https:\u002F\u002Fdeveloper.xamarin.com\u002Fguides\u002Fcross-platform\u002Ftroubleshooting\u002Fquestions\u002Fvisualstudio-2017-rc\u002F",[43,1060,1058],{"href":1058,"rel":1061},[408],[32,1063,1064],{},[43,1065,1067],{"href":1066},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_4.png",[52,1068],{"title":274,"style":484,"border":278,"alt":274,"src":1069,"width":314,"height":1070},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_thumb_1.png",294,[32,1072,1073],{},[43,1074,1076],{"href":1075},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_6.png",[52,1077],{"title":274,"style":484,"border":278,"alt":274,"src":1078,"width":521,"height":881},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_thumb_2.png",[32,1080,1081],{},"Now after above installation it found on the Tools menu",[32,1083,1084],{},[43,1085,1087],{"href":1086},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_16.png",[52,1088],{"title":274,"style":484,"border":278,"alt":274,"src":1089,"width":1090,"height":1091},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_thumb_7.png",298,350,[32,1093,1094],{},"Launch – so I returned to my simple template App and hit debug run with “7 KitKat (4.5)..” emulator. This time the Visual Studio Android emulator started. This is small progress. Watching the Output window however I noticed the following error.",[32,1096,1097],{},[138,1098,1099,1100,1103,1104],{},"02-04 12:47:32.605 D\u002FMono ( 1267): AOT module 'mscorlib.dll.so' not found: dlopen failed: library \"\u002Fdata\u002Fapp-lib\u002FApp1.Droid-2\u002Flibaot-mscorlib.dll.so\" not found02-04 12:47:32.605 D\u002FMono ( 1267): AOT module '\u002FUsers\u002Fbuilder\u002Fdata\u002Flanes\u002F4009\u002F3d959b66\u002Fsource\u002Fmonodroid\u002Fbuilds\u002Finstall\u002Fmono-x86\u002Flib\u002Fmono\u002Faot-cache\u002Fx86\u002Fmscorlib.dll.so' not found: dlopen failed: library \"\u002Fdata\u002Fapp-lib\u002FApp1.Droid-2\u002Flibaot-mscorlib.dll.so\" not found02-04 12:47:32.621 D\u002FMono ( 1267): Config attempting to parse: 'mscorlib.dll.config'.02-04 12:47:32.621 D\u002FMono ( 1267): Config attempting to parse: '\u002FUsers\u002Fbuilder\u002Fdata\u002Flanes\u002F4009\u002F3d959b66\u002Fsource\u002Fmonodroid\u002Fbuilds\u002Finstall\u002Fmono-x86\u002Fetc\u002Fmono\u002Fassemblies\u002Fmscorlib\u002Fmscorlib.config'.02-04 12:47:32.677 D\u002FMono ( 1267): Assembly mscorlib",[68,1101,1102],{},"0xb85ce5c0"," added to domain RootDomain, ref_count=1",[120,1105,1106],{},"Could not connect to the debugger.",[32,1108,1109],{},"At least now, the Android emulator started and it would deploy to the device. I also could run the App on the device. So why would the debugger not attach?",[32,1111,1112],{},[43,1113,1115],{"href":1114},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_8.png",[52,1116],{"title":274,"style":484,"border":278,"alt":274,"src":1117,"width":1118,"height":1119},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_thumb_3.png",376,138,[32,1121,1122],{},"I disabled “Fast Deploy” and retried. Well it would deploy the app but again the debugger was not attached.",[32,1124,1125],{},[43,1126,1128],{"href":1127},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_10.png",[52,1129],{"title":274,"style":484,"border":278,"alt":274,"src":1130,"width":1131,"height":1132},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_thumb_4.png",373,28,[32,1134,1135],{},"Looking at the Hyper-V manager",[32,1137,1138],{},[43,1139,1141],{"href":1140},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_12.png",[52,1142],{"title":274,"style":484,"border":278,"alt":274,"src":1143,"width":521,"height":835},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_thumb_5.png",[32,1145,1146],{},"Reading the reference blog indicated that I need to ‘Migrate to a physical computer with a different processor version” Reference:",[32,1148,1149,1152],{},[43,1150],{"title":1151,"href":1151},"https:\u002F\u002Fdzone.com\u002Farticles\u002Ffix-for-could-not-connect-to-the-debugger-while-de",[43,1153,1151],{"href":1151,"rel":1154},[408],[32,1156,1157],{},[43,1158,1160],{"href":1159},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_14.png",[52,1161],{"title":274,"style":484,"border":278,"alt":274,"src":1162,"width":1163,"height":1164},"\u002Farticles\u002Fimages\u002Fopen-live-writer-starting-emulator-for-avd-phone_x86_tool_a9fa-image_thumb_6.png",396,142,[32,1166,1167,1168,1171],{},"Retrying ",[68,1169,1170],{},">"," Debug run the emulator within Visual Studio 2017, the emulator started correctly..waiting..’is the debugger going to attach?’..suspense now waiting for the build-deploy process. And as the above reference article mentioned Visual Studio was stuck in the preparing stage.",[32,1173,1174],{},"It recommended that internet connection sharing enabled, so I would need to figure out how\u002Fwhere to disable\u002Fenable ‘Internet Sharing’ Using “services.msc” I found ‘Internet Connection Sharing” mine was set to Manual (Trigger Start) –which should be ok? Oddly, I was stuck here and had no idea why it was stuck in the deploy phase. After another hour I enabled by WIFI on my pc. I had it disabled to ensure I was connected via hard-wire.",[32,1176,1177],{},"Well once I enabled WIFI, then closed the emulators and restarted it all started working, and I could step through my Xamarin Forms app once again with Visual Studio 2017.",[237,1179,731],{},{"title":11,"searchDepth":12,"depth":12,"links":1181},[],"2017-02-04T06:37:38.8900000-05:00","Starting Android Emulator with AVD",{},"\u002Farticles\u002Fstarting-emulator-for-avd-phone-x86-toolsforapachecordova",{"title":962,"description":1183},"articles\u002Fstarting-emulator-for-avd-phone-x86-toolsforapachecordova",[18],"-TAnMuDFqTG96UmSEUfTvEzvYi2HrDmTKpNmnIK5nFs",{"id":1191,"title":1192,"author":28,"body":1193,"createdAt":1220,"description":254,"extension":15,"img":1217,"meta":1221,"navigation":19,"path":1222,"seo":1223,"stem":1224,"tags":1225,"updatedAt":1220,"__hash__":1226},"articles\u002Farticles\u002Fbuild-action-embeddedresource.md","Build action 'EmbeddedResource'",{"type":8,"value":1194,"toc":1218},[1195,1198,1201,1204],[32,1196,1197],{},"If you have seen the following the following build errors within Xamarin Forms application…",[32,1199,1200],{},"“Build action 'EmbeddedResource' is not supported by one or more of the project's targets.”",[32,1202,1203],{},"The resolution is to open the properties on the xaml file, change the build action to something else other than Embedded Resource then change it back. ",[32,1205,1206,1207,1209,1210,1212],{},"The build error goes away and everything is good.  The error however does not stop building\u002Frunning the solution however it can be avoided to.",[36,1208],{},"\n ",[36,1211],{},[43,1213,1215],{"href":1214},"\u002Farticles\u002Fimages\u002Fopen-live-writer-build-action-embeddedresource_8fb4-xam_2.png",[52,1216],{"style":395,"src":1217,"border":278,"alt":878,"title":878,"width":880,"height":881},"\u002Farticles\u002Fimages\u002Fopen-live-writer-build-action-embeddedresource_8fb4-xam_thumb.png",{"title":11,"searchDepth":12,"depth":12,"links":1219},[],"2017-02-03T03:16:12.9500000-05:00",{},"\u002Farticles\u002Fbuild-action-embeddedresource",{"title":1192,"description":254},"articles\u002Fbuild-action-embeddedresource",[18],"wt8tNrcjYv7LyIwiCgmGm9SubVJWPaRsHMKv_TYDmjU",{"id":1228,"title":1229,"author":28,"body":1230,"createdAt":1259,"description":254,"extension":15,"img":1240,"meta":1260,"navigation":19,"path":1261,"seo":1262,"stem":1263,"tags":1264,"updatedAt":1259,"__hash__":1265},"articles\u002Farticles\u002Fvisual-studio-emulator-for-android.md","Visual Studio Emulator for Android",{"type":8,"value":1231,"toc":1257},[1232,1235,1242],[32,1233,1234],{},"“The Emulator is unable to connect to the device operating system”",[43,1236,1238],{"href":1237},"\u002Farticles\u002Fimages\u002Fopen-live-writer-visual-studio-emulator-for-android_e589-image_2.png",[52,1239],{"style":395,"src":1240,"border":278,"alt":274,"title":274,"width":521,"height":1241},"\u002Farticles\u002Fimages\u002Fopen-live-writer-visual-studio-emulator-for-android_e589-image_thumb.png",157,[32,1243,1244,1245,1209,1247,1249],{},"The resolution was to ensure the Network Connection – Adapter “vEthernet (Internal Ethernet Port Windows Phone Emulator Internal Switch)” was enabled.",[36,1246],{},[36,1248],{},[43,1250,1252],{"href":1251},"\u002Farticles\u002Fimages\u002Fopen-live-writer-visual-studio-emulator-for-android_e589-image_6.png",[52,1253],{"style":395,"src":1254,"border":278,"alt":274,"title":274,"width":1255,"height":1256},"\u002Farticles\u002Fimages\u002Fopen-live-writer-visual-studio-emulator-for-android_e589-image_thumb_2.png",379,51,{"title":11,"searchDepth":12,"depth":12,"links":1258},[],"2017-01-27T09:23:01.2100000-05:00",{},"\u002Farticles\u002Fvisual-studio-emulator-for-android",{"title":1229,"description":254},"articles\u002Fvisual-studio-emulator-for-android",[18],"LB6Mk4yGa0Ok9lrQNHDt5QnMwYy2Z0eiAeaCriVxOAM",{"id":1267,"title":1268,"author":28,"body":1269,"createdAt":1339,"description":254,"extension":15,"img":1280,"meta":1340,"navigation":19,"path":1341,"seo":1342,"stem":1343,"tags":1344,"updatedAt":1339,"__hash__":1345},"articles\u002Farticles\u002Fxamarin-mac-agent-unable-to-connect.md","Xamarin Mac Agent–Unable to connect",{"type":8,"value":1270,"toc":1337},[1271,1287,1295,1310,1321,1331,1334],[32,1272,1273,1282,1209,1284,1286],{},[43,1274,1277],{"style":1275,"href":1276},"display: none;","\u002Farticles\u002Fimages\u002Fopen-live-writer-0ed91d2b3197_8765-image_2.png",[52,1278],{"style":1279,"src":1280,"border":278,"alt":274,"title":274,"width":1281,"height":1164},"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;","\u002Farticles\u002Fimages\u002Fopen-live-writer-0ed91d2b3197_8765-image_thumb.png",155,[36,1283],{},[36,1285],{},"\nI was unable to connect to Mac today.  Not sure why. ",[32,1288,1289,1290,1294],{},"I found this documentation from Xamarin ",[43,1291,1293],{"href":1292,"target":46},"https:\u002F\u002Fdeveloper.xamarin.com\u002Fguides\u002Fios\u002Fgetting_started\u002Finstallation\u002Fwindows\u002Fconnecting-to-mac\u002F","here",". ",[32,1296,1297,1298,1301,1302,1304,1305,1209,1307,1309],{},"The document ",[43,1299,1293],{"href":1300,"target":46},"https:\u002F\u002Fdeveloper.xamarin.com\u002Fguides\u002Fios\u002Fgetting_started\u002Finstallation\u002Fwindows\u002Fconnecting-to-mac\u002Ftroubleshooting\u002F"," gave me the solution.",[36,1303],{},"\nOnce I did the following I was able to use the Xamarin Mac Agent (Visual Studio – Tools – iOS – Xamarin Mac Agent) to connect.",[36,1306],{},[36,1308],{},"\nNext, test if the ssh client from OpenSSH can connect successfully to the Mac from Windows. One way to install this program is to install",[32,1311,1312,1316,1317,1320],{},[43,1313,1315],{"href":1314},"https:\u002F\u002Fgit-for-windows.github.io\u002F","Git for Windows",". You can then start a ",[120,1318,1319],{},"Git Bash"," command prompt and attempt to ssh in to the Mac with your username and IP address",[32,1322,1323],{},[43,1324,1326],{"href":1325},"\u002Farticles\u002Fimages\u002Fopen-live-writer-0ed91d2b3197_8765-image_4.png",[52,1327],{"style":1279,"src":1328,"border":278,"alt":274,"title":274,"width":1329,"height":1330},"\u002Farticles\u002Fimages\u002Fopen-live-writer-0ed91d2b3197_8765-image_thumb_1.png",559,65,[32,1332,1333],{},"Once this was permanently added the Max Agent successfully connected. ",[32,1335,1336],{},"By the way I found SSH – I had Git for Windows installed, by opening GIT Shell.",{"title":11,"searchDepth":12,"depth":12,"links":1338},[],"2017-01-18T02:46:11.6900000-05:00",{},"\u002Farticles\u002Fxamarin-mac-agent-unable-to-connect",{"title":1268,"description":254},"articles\u002Fxamarin-mac-agent-unable-to-connect",[18],"NW9Sc0uSvm7zSo9Iy-Pw8OzJPVXNMr37ucc_BNMcgng",{"id":1347,"title":1348,"author":28,"body":1349,"createdAt":1520,"description":1521,"extension":15,"img":1364,"meta":1522,"navigation":19,"path":1523,"seo":1524,"stem":1525,"tags":1526,"updatedAt":1520,"__hash__":1527},"articles\u002Farticles\u002Fxamarin-player-failed-to-initialize-device-nexus4.md","Xamarin Player Failed to initialize device Nexus4",{"type":8,"value":1350,"toc":1518},[1351,1354,1357,1366,1372,1387,1391,1394,1409,1412,1434,1437,1446,1458,1461,1470,1473,1485,1497,1506,1509],[32,1352,1353],{},"What’s going on?  I want to run my Android emulator (XAP – Xamarin Android Player) and I get the following issue.",[32,1355,1356],{},"“Failed to initialize device”, “VboxMessage command failed: See log for further details”",[32,1358,1359],{},[43,1360,1362],{"href":1361},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_2.png",[52,1363],{"style":395,"src":1364,"border":278,"alt":274,"title":274,"width":521,"height":1365},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_thumb.png",133,[32,1367,1368,1369],{},"Ok, what’s going on today with my Xamarin Player.  A bit of Google-ing came up with the following information announced at the 2016 Evolve conference. \u003C\n",[120,1370,1371],{},"New Mac OS X Universal Installer",[32,1373,1374,1375,1378,1379,1382,1383,1386],{},"To streamline development setup on Mac OS X, we have introduced a brand ",[120,1376,1377],{},"new universal installer",". This will not only handle updating to the latest version of Xamarin, but also will ",[120,1380,1381],{},"setup the new and improved Android Emulators from Google",", based on x86 HAXM, that are now ",[120,1384,1385],{},"10 times faster then before!"," If you are on Windows using Visual Studio be sure to checkout the Hyper-V enabled",[43,1388,1390],{"href":1389},"https:\u002F\u002Fwww.visualstudio.com\u002Fen-us\u002Ffeatures\u002Fmsft-android-emulator-vs.aspx","\nVisual Studio Emulators for Android",[120,1392,1393],{},"Xamarin Android Player is now officially deprecated",[32,1395,1396,1397,1400,1401,1403,1404],{},"Wow - ",[120,1398,1399],{},"Xamarin Android Player is now officially deprecated – ","This honestly was a surprise as it had worked so well for me in the past.",[36,1402],{},"\nSo as instructed checking out the Hyper-V enabled ",[43,1405,1406],{"href":1389,"target":46},[120,1407,1408],{},"Visual Studio Emulators for Android",[32,1410,1411],{},"I downloaded, installed the emulator promising “The x86 emulator boots and runs at nearly the speed of a physical device, making debugging a breeze on graphics-intensive, processor-hungry apps.”",[32,1413,1414,1415,1421,1423,1424,1209,1426,1428],{}," ",[43,1416,1418],{"href":1417},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image7.png",[52,1419],{"style":395,"src":1420,"border":278,"alt":274,"title":274,"width":522,"height":521},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image7_thumb.png",[36,1422],{},"\n \n \nAfter the installation, I was required to restart.  I opened my Android-Xamarin app thinking I would find this emulator choice in the Visual Studio Device drop down.  Nope.  I found ‘Visual Studio Emulator for Android’ as a recently installed application.  I soon made that attached to my task bar for ease of finding next time.  Starting it, I was challenged with the next hurdle. “You do not have permission to modify internal Hyper-V network adapter settings, which are required to run the emulator” – I hit ‘Retry’ and it appears to be running with the",[36,1425],{},[36,1427],{},[43,1429,1431],{"href":1430},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_4.png",[52,1432],{"style":395,"src":1433,"border":278,"alt":274,"title":274,"width":521,"height":1164},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_thumb_1.png",[32,1435,1436],{},"I hit ‘Retry’ and it appears to be running with the following notification.  Still preparing, I am starting to wonder if anything is going on. ",[32,1438,1439],{},[43,1440,1442],{"href":1441},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_8.png",[52,1443],{"style":395,"src":1444,"border":278,"alt":274,"title":274,"width":521,"height":1445},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_thumb_3.png",37,[32,1447,1448,1449,1451],{},"Bang – I am starting to see something with “OS – Starting” and I now see the emulator.  Whew.",[36,1450],{},[43,1452,1454],{"href":1453},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_10.png",[52,1455],{"style":395,"src":1456,"border":278,"alt":274,"title":274,"width":1457,"height":521},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_thumb_4.png",134,[32,1459,1460],{},"Checking things out, clicking around I try the web browser, and given another test of my competence.  So the problem is, I cannot browse to the internet via the Android Emulator default browser.",[32,1462,1463],{},[43,1464,1466],{"href":1465},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_12.png",[52,1467],{"style":395,"src":1468,"border":278,"alt":274,"title":274,"width":521,"height":1469},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_thumb_5.png",89,[32,1471,1472],{},"I uninstalled Xamarin Android Player – figuring I didn’t need this any more ..moment of silence please.",[32,1474,1475,1476,1478],{},"Ok, so using a few of my Sherlock skills I opened up Hyper-V Manager (found via start search).  Select the emulator then the settings option for that emulator.",[36,1477],{},[43,1479,1481],{"href":1480},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_14.png",[52,1482],{"style":395,"src":1483,"border":278,"alt":274,"title":274,"width":521,"height":1484},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_thumb_6.png",126,[32,1486,1487,1488,1490],{},"I then selected the ‘Emulator External Network Adaptor” and chose my physical network adapter, closed\u002Fshutdown the emulator and restarted.  Great- challenge completed and all seems to be working.",[36,1489],{},[43,1491,1493],{"href":1492},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_16.png",[52,1494],{"style":395,"src":1495,"border":278,"alt":274,"title":274,"width":521,"height":1496},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_thumb_7.png",225,[32,1498,1499],{},[43,1500,1502],{"href":1501},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_18.png",[52,1503],{"style":395,"src":1504,"border":278,"alt":274,"title":274,"width":1505,"height":521},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_thumb_8.png",172,[32,1507,1508],{},"Circling back to my Visual Studio – I am not able to use the Visual Studio Android emulator by selecting the appropriate device.  I have successfully removed the Xamarin Android Player, installed the new\u002Fimproved Visual Studio Emulator and made modifications via Hyper-V Manager to set the network connection of the device to my local hardware on my pc.",[32,1510,1511],{},[43,1512,1514],{"href":1513},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_20.png",[52,1515],{"style":395,"src":1516,"border":278,"alt":274,"title":274,"width":521,"height":1517},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-player-failed-to-initialize-devi_ae14-image_thumb_9.png",38,{"title":11,"searchDepth":12,"depth":12,"links":1519},[],"2016-06-12T06:39:07.8500000-04:00","Failed to initialize...",{},"\u002Farticles\u002Fxamarin-player-failed-to-initialize-device-nexus4",{"title":1348,"description":1521},"articles\u002Fxamarin-player-failed-to-initialize-device-nexus4",[18],"-lzYhCSoLfeLoNk6Ny6UBEB46Y35mtv4t2kMDAnjhGE",{"id":1529,"title":1530,"author":28,"body":1531,"createdAt":2082,"description":1535,"extension":15,"img":2076,"meta":2083,"navigation":19,"path":2084,"seo":2085,"stem":2086,"tags":2087,"updatedAt":2082,"__hash__":2088},"articles\u002Farticles\u002Fxamarin-android-fragments-and-orientations-rotation.md","Xamarin Android - Fragments and Orientations\u002FRotation",{"type":8,"value":1532,"toc":2080},[1533,1536,1539,1542,1553,1556,1586,1589,1695,1698,1754,1757,2055,2078],[32,1534,1535],{},"When you rotate\u002Fchange the orientation of your Android application the Activity will be destroyed and recreated.  What this means is that any variables, fragments will be destroyed when the user changes the orientation of their device (say going from portrait to landscape).  Your users will hate you.  For example, If they are filling out a form and by accident the orientation changes all fields entered will be lost.",[32,1537,1538],{},"How can we avoid this bad experience? There are a few ways.",[32,1540,1541],{},"Within the OnCreate of the Activity you can force the orientation to one or the other.  A user can rotate the device however the user interface does not change orientation.",[59,1543,1547],{"className":1544,"code":1545,"language":1546,"meta":11,"style":11},"language-csharp shiki shiki-themes github-light github-dark","RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;\n","csharp",[65,1548,1549],{"__ignoreMap":11},[68,1550,1551],{"class":70,"line":71},[68,1552,1545],{},[32,1554,1555],{},"Using an attribute on the class will lock the orientation.  The following ignores the orientation and the screen size changes.  This is easy however the difficulty is that your application will not be responsive to size\u002Forientation changes.  Your application will respond to different screen sizes or orientation.  This too can be less than optimum.",[59,1557,1559],{"className":1544,"code":1558,"language":1546,"meta":11,"style":11},"[Activity(Label = \"AppDave\", MainLauncher = true, Icon = \"@drawable\u002Ficon\", \nTheme = \"@style\u002FMyTheme\", ConfigurationChanges = Android.Content.PM.ConfigChanges.ScreenSize | Android.Content.PM.ConfigChanges.Orientation)]  \npublic class MainActivity : AppCompatActivity  \n{  \n}\n",[65,1560,1561,1566,1571,1576,1581],{"__ignoreMap":11},[68,1562,1563],{"class":70,"line":71},[68,1564,1565],{},"[Activity(Label = \"AppDave\", MainLauncher = true, Icon = \"@drawable\u002Ficon\", \n",[68,1567,1568],{"class":70,"line":12},[68,1569,1570],{},"Theme = \"@style\u002FMyTheme\", ConfigurationChanges = Android.Content.PM.ConfigChanges.ScreenSize | Android.Content.PM.ConfigChanges.Orientation)]  \n",[68,1572,1573],{"class":70,"line":82},[68,1574,1575],{},"public class MainActivity : AppCompatActivity  \n",[68,1577,1578],{"class":70,"line":88},[68,1579,1580],{},"{  \n",[68,1582,1583],{"class":70,"line":94},[68,1584,1585],{},"}\n",[32,1587,1588],{},"In the following example I have an application with three fragments.   The first fragment with tag “Fragment1” gets set when the application loads.  I will use this tag as the test to see if the activity has started at least one time.  Within the OnCreate method I check to see if the Activity has run by checking SupportFragmentManager.FindFragmentByTag(“Fragment1”).",[59,1590,1592],{"className":1544,"code":1591,"language":1546,"meta":11,"style":11},"if (SupportFragmentManager.FindFragmentByTag(\"Fragment1\") != null)  \n{  \n    if (SupportFragmentManager.FindFragmentByTag(\"Fragment1\") != null)  \n        _fragment1 = SupportFragmentManager.FindFragmentByTag(\"Fragment1\") as Fragment1;  \n  \n    if (SupportFragmentManager.FindFragmentByTag(\"Fragment2\") != null)  \n        _fragment2 = SupportFragmentManager.FindFragmentByTag(\"Fragment2\") as Fragment2;  \n  \n    if (SupportFragmentManager.FindFragmentByTag(\"Fragment3\") != null)  \n        _fragment3 = SupportFragmentManager.FindFragmentByTag(\"Fragment3\") as Fragment3;  \n}  \nelse  \n{  \n    \u002F\u002Fno fragments in the container  \n    _fragment1 = new Fragment1();  \n      \n    var trans = SupportFragmentManager.BeginTransaction();  \n    trans.Add(Resource.Id.fragmentContainer, _fragment1, \"Fragment1\");                  \n    trans.Commit();  \n    _currentFragment = _fragment1;  \n}\n",[65,1593,1594,1599,1603,1608,1613,1618,1623,1628,1632,1637,1642,1647,1652,1656,1661,1666,1671,1676,1681,1686,1691],{"__ignoreMap":11},[68,1595,1596],{"class":70,"line":71},[68,1597,1598],{},"if (SupportFragmentManager.FindFragmentByTag(\"Fragment1\") != null)  \n",[68,1600,1601],{"class":70,"line":12},[68,1602,1580],{},[68,1604,1605],{"class":70,"line":82},[68,1606,1607],{},"    if (SupportFragmentManager.FindFragmentByTag(\"Fragment1\") != null)  \n",[68,1609,1610],{"class":70,"line":88},[68,1611,1612],{},"        _fragment1 = SupportFragmentManager.FindFragmentByTag(\"Fragment1\") as Fragment1;  \n",[68,1614,1615],{"class":70,"line":94},[68,1616,1617],{},"  \n",[68,1619,1620],{"class":70,"line":584},[68,1621,1622],{},"    if (SupportFragmentManager.FindFragmentByTag(\"Fragment2\") != null)  \n",[68,1624,1625],{"class":70,"line":590},[68,1626,1627],{},"        _fragment2 = SupportFragmentManager.FindFragmentByTag(\"Fragment2\") as Fragment2;  \n",[68,1629,1630],{"class":70,"line":596},[68,1631,1617],{},[68,1633,1634],{"class":70,"line":601},[68,1635,1636],{},"    if (SupportFragmentManager.FindFragmentByTag(\"Fragment3\") != null)  \n",[68,1638,1639],{"class":70,"line":607},[68,1640,1641],{},"        _fragment3 = SupportFragmentManager.FindFragmentByTag(\"Fragment3\") as Fragment3;  \n",[68,1643,1644],{"class":70,"line":613},[68,1645,1646],{},"}  \n",[68,1648,1649],{"class":70,"line":619},[68,1650,1651],{},"else  \n",[68,1653,1654],{"class":70,"line":625},[68,1655,1580],{},[68,1657,1658],{"class":70,"line":630},[68,1659,1660],{},"    \u002F\u002Fno fragments in the container  \n",[68,1662,1663],{"class":70,"line":636},[68,1664,1665],{},"    _fragment1 = new Fragment1();  \n",[68,1667,1668],{"class":70,"line":641},[68,1669,1670],{},"      \n",[68,1672,1673],{"class":70,"line":647},[68,1674,1675],{},"    var trans = SupportFragmentManager.BeginTransaction();  \n",[68,1677,1678],{"class":70,"line":652},[68,1679,1680],{},"    trans.Add(Resource.Id.fragmentContainer, _fragment1, \"Fragment1\");                  \n",[68,1682,1683],{"class":70,"line":658},[68,1684,1685],{},"    trans.Commit();  \n",[68,1687,1688],{"class":70,"line":664},[68,1689,1690],{},"    _currentFragment = _fragment1;  \n",[68,1692,1693],{"class":70,"line":669},[68,1694,1585],{},[32,1696,1697],{},"I am going through this backwards but this is the method that I am using to replace the current fragment with a new one.  Notice however that I am adding it with a specified tag so that we can recover it later",[59,1699,1701],{"className":1544,"code":1700,"language":1546,"meta":11,"style":11},"private void ReplaceFragment(SupportFragment fragment, string tag)  \n{  \n    if (fragment.IsVisible)  \n        return;  \n  \n    var trans = SupportFragmentManager.BeginTransaction();             \n    trans.Replace(Resource.Id.fragmentContainer, fragment, tag);  \n    trans.AddToBackStack(null);  \n    trans.Commit();  \n    _currentFragment = fragment;  \n}\n",[65,1702,1703,1708,1712,1717,1722,1726,1731,1736,1741,1745,1750],{"__ignoreMap":11},[68,1704,1705],{"class":70,"line":71},[68,1706,1707],{},"private void ReplaceFragment(SupportFragment fragment, string tag)  \n",[68,1709,1710],{"class":70,"line":12},[68,1711,1580],{},[68,1713,1714],{"class":70,"line":82},[68,1715,1716],{},"    if (fragment.IsVisible)  \n",[68,1718,1719],{"class":70,"line":88},[68,1720,1721],{},"        return;  \n",[68,1723,1724],{"class":70,"line":94},[68,1725,1617],{},[68,1727,1728],{"class":70,"line":584},[68,1729,1730],{},"    var trans = SupportFragmentManager.BeginTransaction();             \n",[68,1732,1733],{"class":70,"line":590},[68,1734,1735],{},"    trans.Replace(Resource.Id.fragmentContainer, fragment, tag);  \n",[68,1737,1738],{"class":70,"line":596},[68,1739,1740],{},"    trans.AddToBackStack(null);  \n",[68,1742,1743],{"class":70,"line":601},[68,1744,1685],{},[68,1746,1747],{"class":70,"line":607},[68,1748,1749],{},"    _currentFragment = fragment;  \n",[68,1751,1752],{"class":70,"line":613},[68,1753,1585],{},[32,1755,1756],{},"And finally I will show the method that responds to a menu selection which calls the ReplaceFragment method",[59,1758,1760],{"className":1544,"code":1759,"language":1546,"meta":11,"style":11},"public override bool OnOptionsItemSelected(IMenuItem item)  \n{      \n    switch (item.ItemId)  \n    {                  \n        case Android.Resource.Id.Home:  \n            \u002F\u002FThe hamburger icon was clicked which means the drawer toggle will handle the event  \n            \u002F\u002Fall we need to do is ensure the right drawer is closed so the don't overlap  \n            _drawerLayout.CloseDrawer(_rightDrawer);  \n            _drawerToggle.OnOptionsItemSelected(item);  \n            return true;  \n  \n        \u002F\u002Fcase Resource.Id.action_refresh:  \n        \u002F\u002F    \u002F\u002FRefresh  \n        \u002F\u002F    return true;  \n  \n        case Resource.Id.action_fragment1:  \n            \u002F\u002FShowFragment(_fragment1);  \n  \n            if (_fragment1 == null)                      \n                _fragment1 = new Fragment1();            \n                  \n                ReplaceFragment(_fragment1, \"Fragment1\");  \n            return true;  \n        case Resource.Id.action_fragment2:  \n            \u002F\u002FShowFragment(_fragment2);  \n            if (_fragment2 == null)   \n                _fragment2 = new Fragment2();  \n                  \n            ReplaceFragment(_fragment2, \"Fragment2\");  \n            return true;  \n        case Resource.Id.action_fragment3:  \n            \u002F\u002FShowFragment(_fragment3);  \n              \n            if (_fragment3 == null)                      \n                _fragment3 = new Fragment3();  \n  \n            ReplaceFragment(_fragment3, \"Fragment3\");  \n            return true;  \n        case Resource.Id.action_help:  \n            if (_drawerLayout.IsDrawerOpen(_rightDrawer))  \n            {  \n                \u002F\u002FRight Drawer is already open, close it  \n                _drawerLayout.CloseDrawer(_rightDrawer);  \n            }  \n            else  \n            {  \n                \u002F\u002FRight Drawer is closed, open it and just in case close left drawer  \n                _drawerLayout.OpenDrawer(_rightDrawer);  \n                _drawerLayout.CloseDrawer(_leftDrawer);  \n            }  \n            return true;  \n        default:  \n            return base.OnOptionsItemSelected(item);  \n    }  \n}\n",[65,1761,1762,1767,1772,1777,1782,1787,1792,1797,1802,1807,1812,1816,1821,1829,1834,1838,1843,1848,1852,1857,1862,1867,1872,1877,1883,1889,1895,1901,1905,1911,1916,1922,1928,1934,1940,1946,1950,1955,1959,1965,1971,1977,1983,1989,1995,2001,2006,2011,2017,2023,2028,2032,2038,2044,2050],{"__ignoreMap":11},[68,1763,1764],{"class":70,"line":71},[68,1765,1766],{},"public override bool OnOptionsItemSelected(IMenuItem item)  \n",[68,1768,1769],{"class":70,"line":12},[68,1770,1771],{},"{      \n",[68,1773,1774],{"class":70,"line":82},[68,1775,1776],{},"    switch (item.ItemId)  \n",[68,1778,1779],{"class":70,"line":88},[68,1780,1781],{},"    {                  \n",[68,1783,1784],{"class":70,"line":94},[68,1785,1786],{},"        case Android.Resource.Id.Home:  \n",[68,1788,1789],{"class":70,"line":584},[68,1790,1791],{},"            \u002F\u002FThe hamburger icon was clicked which means the drawer toggle will handle the event  \n",[68,1793,1794],{"class":70,"line":590},[68,1795,1796],{},"            \u002F\u002Fall we need to do is ensure the right drawer is closed so the don't overlap  \n",[68,1798,1799],{"class":70,"line":596},[68,1800,1801],{},"            _drawerLayout.CloseDrawer(_rightDrawer);  \n",[68,1803,1804],{"class":70,"line":601},[68,1805,1806],{},"            _drawerToggle.OnOptionsItemSelected(item);  \n",[68,1808,1809],{"class":70,"line":607},[68,1810,1811],{},"            return true;  \n",[68,1813,1814],{"class":70,"line":613},[68,1815,1617],{},[68,1817,1818],{"class":70,"line":619},[68,1819,1820],{},"        \u002F\u002Fcase Resource.Id.action_refresh:  \n",[68,1822,1823,1826],{"class":70,"line":625},[68,1824,1825],{},"        \u002F\u002F",[68,1827,1828],{},"    \u002F\u002FRefresh  \n",[68,1830,1831],{"class":70,"line":630},[68,1832,1833],{},"        \u002F\u002F    return true;  \n",[68,1835,1836],{"class":70,"line":636},[68,1837,1617],{},[68,1839,1840],{"class":70,"line":641},[68,1841,1842],{},"        case Resource.Id.action_fragment1:  \n",[68,1844,1845],{"class":70,"line":647},[68,1846,1847],{},"            \u002F\u002FShowFragment(_fragment1);  \n",[68,1849,1850],{"class":70,"line":652},[68,1851,1617],{},[68,1853,1854],{"class":70,"line":658},[68,1855,1856],{},"            if (_fragment1 == null)                      \n",[68,1858,1859],{"class":70,"line":664},[68,1860,1861],{},"                _fragment1 = new Fragment1();            \n",[68,1863,1864],{"class":70,"line":669},[68,1865,1866],{},"                  \n",[68,1868,1869],{"class":70,"line":675},[68,1870,1871],{},"                ReplaceFragment(_fragment1, \"Fragment1\");  \n",[68,1873,1875],{"class":70,"line":1874},23,[68,1876,1811],{},[68,1878,1880],{"class":70,"line":1879},24,[68,1881,1882],{},"        case Resource.Id.action_fragment2:  \n",[68,1884,1886],{"class":70,"line":1885},25,[68,1887,1888],{},"            \u002F\u002FShowFragment(_fragment2);  \n",[68,1890,1892],{"class":70,"line":1891},26,[68,1893,1894],{},"            if (_fragment2 == null)   \n",[68,1896,1898],{"class":70,"line":1897},27,[68,1899,1900],{},"                _fragment2 = new Fragment2();  \n",[68,1902,1903],{"class":70,"line":1132},[68,1904,1866],{},[68,1906,1908],{"class":70,"line":1907},29,[68,1909,1910],{},"            ReplaceFragment(_fragment2, \"Fragment2\");  \n",[68,1912,1914],{"class":70,"line":1913},30,[68,1915,1811],{},[68,1917,1919],{"class":70,"line":1918},31,[68,1920,1921],{},"        case Resource.Id.action_fragment3:  \n",[68,1923,1925],{"class":70,"line":1924},32,[68,1926,1927],{},"            \u002F\u002FShowFragment(_fragment3);  \n",[68,1929,1931],{"class":70,"line":1930},33,[68,1932,1933],{},"              \n",[68,1935,1937],{"class":70,"line":1936},34,[68,1938,1939],{},"            if (_fragment3 == null)                      \n",[68,1941,1943],{"class":70,"line":1942},35,[68,1944,1945],{},"                _fragment3 = new Fragment3();  \n",[68,1947,1948],{"class":70,"line":502},[68,1949,1617],{},[68,1951,1952],{"class":70,"line":1445},[68,1953,1954],{},"            ReplaceFragment(_fragment3, \"Fragment3\");  \n",[68,1956,1957],{"class":70,"line":1517},[68,1958,1811],{},[68,1960,1962],{"class":70,"line":1961},39,[68,1963,1964],{},"        case Resource.Id.action_help:  \n",[68,1966,1968],{"class":70,"line":1967},40,[68,1969,1970],{},"            if (_drawerLayout.IsDrawerOpen(_rightDrawer))  \n",[68,1972,1974],{"class":70,"line":1973},41,[68,1975,1976],{},"            {  \n",[68,1978,1980],{"class":70,"line":1979},42,[68,1981,1982],{},"                \u002F\u002FRight Drawer is already open, close it  \n",[68,1984,1986],{"class":70,"line":1985},43,[68,1987,1988],{},"                _drawerLayout.CloseDrawer(_rightDrawer);  \n",[68,1990,1992],{"class":70,"line":1991},44,[68,1993,1994],{},"            }  \n",[68,1996,1998],{"class":70,"line":1997},45,[68,1999,2000],{},"            else  \n",[68,2002,2004],{"class":70,"line":2003},46,[68,2005,1976],{},[68,2007,2008],{"class":70,"line":835},[68,2009,2010],{},"                \u002F\u002FRight Drawer is closed, open it and just in case close left drawer  \n",[68,2012,2014],{"class":70,"line":2013},48,[68,2015,2016],{},"                _drawerLayout.OpenDrawer(_rightDrawer);  \n",[68,2018,2020],{"class":70,"line":2019},49,[68,2021,2022],{},"                _drawerLayout.CloseDrawer(_leftDrawer);  \n",[68,2024,2026],{"class":70,"line":2025},50,[68,2027,1994],{},[68,2029,2030],{"class":70,"line":1256},[68,2031,1811],{},[68,2033,2035],{"class":70,"line":2034},52,[68,2036,2037],{},"        default:  \n",[68,2039,2041],{"class":70,"line":2040},53,[68,2042,2043],{},"            return base.OnOptionsItemSelected(item);  \n",[68,2045,2047],{"class":70,"line":2046},54,[68,2048,2049],{},"    }  \n",[68,2051,2053],{"class":70,"line":2052},55,[68,2054,1585],{},[32,2056,2057,2058,1209,2060,2062,2063,2066,2069,2071],{},"So finally, why are we using the transaction manager to replace fragments instead of showing and hiding them?  If we load up all fragments upon start up and show\u002Fhide they all are residing in memory which can be problematic if the fragments are large or you have many of them in your application.  Using the replace approach optimizes memory to only work with active fragments.  While a fragment is not in the current layout it is ‘paused’ and the memory footprint is much less.",[36,2059],{},[36,2061],{},"\nReference: ",[43,2064],{"href":2065,"title":2065},"http:\u002F\u002Fdeveloper.android.com\u002Fguide\u002Fcomponents\u002Ffragments.html",[43,2067,2065],{"href":2065,"rel":2068},[408],[36,2070],{},[43,2072,2074],{"href":2073},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-fragments-and-orientat_957a-image_2.png",[52,2075],{"style":395,"src":2076,"border":278,"alt":274,"title":274,"width":2077,"height":521},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-fragments-and-orientat_957a-image_thumb.png",228,[237,2079,239],{},{"title":11,"searchDepth":12,"depth":12,"links":2081},[],"2016-02-14T04:36:35.5200000-05:00",{},"\u002Farticles\u002Fxamarin-android-fragments-and-orientations-rotation",{"title":1530,"description":1535},"articles\u002Fxamarin-android-fragments-and-orientations-rotation",[18],"ptH_PqAAUCLJDvJogWefd7tmS1dafuuixCi8v4M0HA8",{"id":2090,"title":2091,"author":28,"body":2092,"createdAt":2222,"description":2223,"extension":15,"img":2104,"meta":2224,"navigation":19,"path":2225,"seo":2226,"stem":2227,"tags":2228,"updatedAt":2222,"__hash__":2229},"articles\u002Farticles\u002Fxamarin-android-use-toolbar-in-place-of-actionbar.md","Xamarin Android - Use Toolbar in place of ActionBar",{"type":8,"value":2093,"toc":2220},[2094,2109,2115,2130,2135,2138,2155,2162,2167,2194,2204,2207,2211],[32,2095,2096,2097,2099,2106,2108],{},"Add references to Xamarin.Android.Support.v7.AppCompat (this will also include Xamarin.Android.Support.v4)",[36,2098],{},[43,2100,2102],{"href":2101},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_2.png",[52,2103],{"style":1279,"src":2104,"border":278,"alt":274,"title":274,"width":521,"height":2105},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_thumb.png",209,[36,2107],{},"\nOpen Main.axml adding the following toolbar element",[59,2110,2114],{"className":2111},[2112,2113],"brush:","xml;","\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>  \n\u003Candroid.support.v7.widget.Toolbar xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"  \n    xmlns:app=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres-auto\"  \n    android:id=\"@+id\u002Ftoolbar\"  \n    android:layout_height=\"wrap_content\"  \n    android:minHeight=\"?attr\u002FactionBarSize\"  \n    android:background=\"?attr\u002FcolorPrimary\"  \n    android:layout_width=\"match_parent\" \u002F>",[32,2116,2117,2118,2120,2127,2129],{},"Opening in the designer we have",[36,2119],{},[43,2121,2123],{"href":2122},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_4.png",[52,2124],{"style":1279,"src":2125,"border":278,"alt":274,"title":274,"width":398,"height":2126},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_thumb_1.png",117,[36,2128],{},"\nUpdating MainActivity.cs",[59,2131,2134],{"className":2132},[2112,2133],"csharp;","using System;  \nusing Android.App;  \nusing Android.Content;  \nusing Android.Runtime;  \nusing Android.Views;  \nusing Android.Widget;  \nusing Android.OS;  \nusing SupportToolbar = Android.Support.V7.Widget.Toolbar;  \nusing Android.Support.V7.App;  \nusing Android.Support.V4.Widget;  \nusing System.Collections.Generic;  \n  \nnamespace AppDave  \n{      \n    [Activity(Label = \"AppDave\", MainLauncher = true, Icon = \"@drawable\u002Ficon\", Theme=\"@style\u002FMyTheme\")]  \n    public class MainActivity : ActionBarActivity  \n    {  \n        private SupportToolbar _toolbar;  \n  \n        protected override void OnCreate(Bundle bundle)  \n        {  \n            base.OnCreate(bundle);                      \n            SetContentView(Resource.Layout.Main);  \n  \n            _toolbar = FindViewById\u003CSupportToolbar>(Resource.Id.toolbar);  \n            \u002F\u002Fsets the actionbar to our toolbar  \n            SetSupportActionBar(_toolbar);    \n            \u002F\u002Fwe can now call our toolbar via SupportActionBar  \n            SupportActionBar.Title = \"MyToolbar\";  \n        }  \n  \n        public override bool OnCreateOptionsMenu(IMenu menu)  \n        {              \n            MenuInflater.Inflate(Resource.Menu.action_menu, menu);  \n            return base.OnCreateOptionsMenu(menu);  \n        }  \n    }  \n}",[32,2136,2137],{},"Notes:",[280,2139,2140,2143,2146,2149,2152],{},[283,2141,2142],{},"I am deriving from ActionBarActivity instead of Activity (see above)",[283,2144,2145],{},"I am using a styles.xml. This will be used to specify the theme that will be applied to the activity.  The theme will inherit from the AppCompat.Light theme. Then at this point we can override the default values for that theme.",[283,2147,2148],{},"Note: instead of specifying .NoActionBar as shown below I have read that you can also specify the parent as Theme.AppCompat.Light then the first attribute would be \u003Citem name=”windowActionBar”>false\u003C\u002Fitem>  I found however by specifying no action bar in this manner I had the following exception “Java.Lang.IllegalArgumentException: AppCompat does not support the current theme features”.  As a result I did have to use the .NoActionBar option as shown in the xml snippet.",[283,2150,2151],{},"SetSupportActionBar will be used to actually set the action bar to our toolbar.  At this point, SupportActionBar will be used to call the toolbar.",[283,2153,2154],{},"In order to get the action menu to be inflated on the toolbar use public override OnCreateOptionsMenu",[2156,2157,1617,2158,1617],"blockquote",{},[59,2159,2161],{"className":2160},[2112,2113],"\u003C?xml version=\"1.0\" encoding=\"utf-8\" ?>  \n\u003Cresources>    \n  \u003Cstyle name=\"MyTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">   \n    \u003Citem name=\"colorPrimary\">#2196F3\u003C\u002Fitem>  \n  \u003C\u002Fstyle>  \n\u003C\u002Fresources>  \n",[280,2163,2164],{},[283,2165,2166],{},"The menu within the toolbar is also specified via action_menu.xml.  This will be the quick menu on the top right.",[2156,2168,1617,2169],{},[59,2170,2172,2173],{"className":2171},[2112,2113],"\u003C?xml version=\"1.0\" encoding=\"UTF-8\" ?>  \n\u003Cmenu  \n    xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"  \n    xmlns:app=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres-auto\">  \n",[32,2174,2175,2176,2178,2179,2181,2182,2184,2185,2187,2188,2190,2191,2193],{},"\u003Citem android:id=\"@+id\u002Faction_help\"",[36,2177],{},"\nandroid:icon=\"@drawable\u002Fic_action_help\"",[36,2180],{},"\nandroid:title=\"Help\"\u002F>",[36,2183],{},"\n\u003Citem android:id=\"@+id\u002Faction_refresh\"",[36,2186],{},"\nandroid:icon=\"@drawable\u002Fic_action_refresh\"",[36,2189],{},"\nandroid:title=\"Refresh\"\u002F>",[36,2192],{},"\n\u003C\u002Fmenu>",[32,2195,2196],{},[43,2197,2199],{"href":2198},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_6.png",[52,2200],{"style":395,"src":2201,"border":278,"alt":274,"title":274,"width":2202,"height":2203},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_thumb_2.png",199,318,[32,2205,2206],{},"Note: in the above action menu we did not override the app : showAsAction element.  If I specify showAsAction in the following manner you can see the differences.  When specifying as never the icon is visible to the left of the …",[59,2208,2210],{"className":2209},[2112,2113],"\u003C?xml version=\"1.0\" encoding=\"UTF-8\" ?>  \n\u003Cmenu  \n    xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"  \n    xmlns:app=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres-auto\">  \n  \n  \u003Citem android:id=\"@+id\u002Faction_help\"  \n        android:icon=\"@drawable\u002Fic_action_help\"  \n        android:title=\"Help\"  \n        app:showAsAction=\"always\"  \n        \u002F>  \n  \n  \u003Citem android:id=\"@+id\u002Faction_refresh\"  \n        android:icon=\"@drawable\u002Fic_action_refresh\"  \n        android:title=\"Refresh\"  \n        app:showAsAction=\"never\"  \n        \u002F>  \n\u003C\u002Fmenu>  \n",[32,2212,2213],{},[43,2214,2216],{"href":2215},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_8.png",[52,2217],{"style":395,"src":2218,"border":278,"alt":274,"title":274,"width":521,"height":2219},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_thumb_3.png",77,{"title":11,"searchDepth":12,"depth":12,"links":2221},[],"2016-02-07T09:50:32.1900000-05:00","A toolbar in place of an actionbar with a menu, the end result.",{},"\u002Farticles\u002Fxamarin-android-use-toolbar-in-place-of-actionbar",{"title":2091,"description":2223},"articles\u002Fxamarin-android-use-toolbar-in-place-of-actionbar",[18],"3MdES8JhgEfxYHKgSOClj6WwiA-BKs6xZS5LaqZ_HSc",{"id":2231,"title":2232,"author":28,"body":2233,"createdAt":2279,"description":254,"extension":15,"img":2280,"meta":2281,"navigation":19,"path":2282,"seo":2283,"stem":2284,"tags":2285,"updatedAt":2279,"__hash__":2286},"articles\u002Farticles\u002Fxamarin-no-intellisense-in-axml-files.md","Xamarin No Intellisense in Xaml files",{"type":8,"value":2234,"toc":2277},[2235,2241,2252,2272],[32,2236,2237,2240],{},[120,2238,2239],{},"Issue: ","Opening up AXML file and no intellisense in Visual Studio",[280,2242,2243,2246,2249],{},[283,2244,2245],{},"open file explorer, navigate to c:\\program files (x86)\\MSBuild\\Xamarin",[283,2247,2248],{},"copy android-layout-xml.xsd and schemas.android.com.apk.res.android.xsd to C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Xml\\Schemas",[283,2250,2251],{},"XML – Schemas and Add selecting the 2 xsd files",[2156,2253,1617,2254,1617,2263,1617],{},[43,2255,2257],{"href":2256},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-3-_2.png",[52,2258],{"style":2259,"src":2260,"border":278,"alt":2261,"title":2261,"width":521,"height":2262},"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;","\u002Farticles\u002Fimages\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-3-_thumb.png","image_thumb[3]",111,[43,2264,2266],{"href":2265},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-6-_2.png",[52,2267],{"style":2259,"src":2268,"border":278,"alt":2269,"title":2269,"width":2270,"height":2271},"\u002Farticles\u002Fimages\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-6-_thumb.png","image_thumb[6]",414,112,[280,2273,2274],{},[283,2275,2276],{},"Restart Visual Studio and your intellisense should be working now.",{"title":11,"searchDepth":12,"depth":12,"links":2278},[],"2016-02-07T06:35:18.3500000-05:00","\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-3-_thumb.png",{},"\u002Farticles\u002Fxamarin-no-intellisense-in-axml-files",{"title":2232,"description":254},"articles\u002Fxamarin-no-intellisense-in-axml-files",[18],"d2O3r4wtEPfVXQIoN_pal9vSxXjlFioRYQ0UIQJX7IQ",{"id":2288,"title":2289,"author":28,"body":2290,"createdAt":2361,"description":254,"extension":15,"img":2339,"meta":2362,"navigation":19,"path":2363,"seo":2364,"stem":2365,"tags":2366,"updatedAt":2361,"__hash__":2367},"articles\u002Farticles\u002Fxamarin-please-install-package-android-support-library.md","Xamarin Please install package ‘Android Support Library’",{"type":8,"value":2291,"toc":2359},[2292,2295,2325,2341,2348,2356],[32,2293,2294],{},"  My Xamarin Android project would not build.  The build output had the following exception\u002Ferror.\nSeverity Code Description Project File Line Suppression State Error",[59,2296,2298],{"className":552,"code":2297,"language":554,"meta":11,"style":11},"Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. \nAndroid resource directory C:\\Users\\{username}\\AppData\\Local\\Xamarin\\Android.Support.v4\\22.2.0\\embedded\\.\u002F doesn't exist.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \nC:\\Program Files (x86)\\MSBuild\\Xamarin\\Android\\Xamarin.Android.Common.targets 349&nbsp;&nbsp;&nbsp;  \n",[65,2299,2300,2305,2317],{"__ignoreMap":11},[68,2301,2302],{"class":70,"line":71},[68,2303,2304],{"class":561},"Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. \n",[68,2306,2307,2310,2314],{"class":70,"line":12},[68,2308,2309],{"class":561},"Android resource directory C:\\Users\\{username}\\AppData\\Local\\Xamarin\\Android.Support.v4\\22.2.0\\embedded\\.\u002F doesn't exist.",[68,2311,2313],{"class":2312},"sj4cs","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",[68,2315,2316],{"class":561}," \n",[68,2318,2319,2322],{"class":70,"line":82},[68,2320,2321],{"class":561},"C:\\Program Files (x86)\\MSBuild\\Xamarin\\Android\\Xamarin.Android.Common.targets 349",[68,2323,2324],{"class":2312},"&nbsp;&nbsp;&nbsp;\n",[32,2326,2327,2328,2333,2334],{},"I started to get this error after adding the component Android Support Library v7 AppCompat (version 22.2.0.0) This component has dependencies on Xamarin.Android.Support.v4.\nAfter much time and looking at Android SDK’s ",[120,2329,2330],{},[172,2331,2332],{},"the resolution"," was to remove the respective zip file from this directory\nC:\\Users{username}\\AppData\\Local\\Xamarin\\zips. Once I did this, a fresh build would re-download this package and unzip appropriate references\nto C:\\Users{username}\\AppData\\Local\\Xamarin.  In addition you can delete everything in the C:\\Users{username}\\AppData\\Local\\Xamarin\\Android.Support.v4 directory.\n",[43,2335,2337],{"href":2336},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-245aeb9a3723_fde8-image_6.png",[52,2338],{"title":274,"style":484,"border":278,"alt":274,"src":2339,"width":1070,"height":2340},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-245aeb9a3723_fde8-image_thumb_2.png",88,[43,2342,2344],{"href":2343},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-245aeb9a3723_fde8-image_4.png",[52,2345],{"title":274,"style":484,"border":278,"alt":274,"src":2346,"width":2347,"height":2025},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-245aeb9a3723_fde8-image_thumb_1.png",411,[43,2349,2351],{"href":2350},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-245aeb9a3723_fde8-image_2.png",[52,2352],{"title":274,"style":484,"border":278,"alt":274,"src":2353,"width":2354,"height":2355},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-245aeb9a3723_fde8-image_thumb.png",417,233,[237,2357,2358],{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":11,"searchDepth":12,"depth":12,"links":2360},[],"2016-02-06T12:29:47.8100000-05:00",{},"\u002Farticles\u002Fxamarin-please-install-package-android-support-library",{"title":2289,"description":254},"articles\u002Fxamarin-please-install-package-android-support-library",[18],"8pRh1b0XfQH5mWwb5lohfycB3F0kfUGsZ2iKu_RUjUQ",{"id":2369,"title":2370,"author":28,"body":2371,"createdAt":2433,"description":2434,"extension":15,"img":2383,"meta":2435,"navigation":19,"path":2436,"seo":2437,"stem":2438,"tags":2439,"updatedAt":2433,"__hash__":2440},"articles\u002Farticles\u002Fxamarin-android-actionbar.md","Xamarin Android ActionBar",{"type":8,"value":2372,"toc":2431},[2373,2388,2392,2395,2399,2402,2406],[32,2374,2375,2376,2378,2385,2387],{},"Ok so in prior posts I talked about adding drawer layout to my android project.  Today, I am going to add an actionbar to the project.  Starting with the end result of my first attempt see below.  I have an activity with tabs on each view.",[36,2377],{},[43,2379,2381],{"href":2380},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_a3b5-image_2.png",[52,2382],{"style":1279,"src":2383,"border":278,"alt":274,"title":274,"width":2384,"height":521},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_a3b5-image_thumb.png",151,[36,2386],{},"\nThis is how that was accomplished.  Within the OnCreate(Bundle bundle) method of the Activity",[59,2389,2391],{"className":2390},[2112,2133],"this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;              \nAddTab(\"Tab 1\", Resource.Drawable.ic_tab_white, new SampleTabFragment());  \nAddTab(\"Tab 2\", Resource.Drawable.ic_tab_white, new SampleTabFragment2());  \n  \nif (bundle != null)     this.ActionBar.SelectTab(this.ActionBar.GetTabAt(bundle.GetInt(\"tab\")));",[32,2393,2394],{},"Adding method AddTab",[59,2396,2398],{"className":2397},[2112,2133],"        void AddTab(string tabText, int iconResourceId, Fragment view)  \n        {  \n            var tab = this.ActionBar.NewTab();  \n            tab.SetText(tabText);  \n            tab.SetIcon(Resource.Drawable.ic_tab_white);  \n  \n            \u002F\u002F must set event handler before adding tab  \n  \n            tab.TabSelected += delegate (object sender, Android.App.ActionBar.TabEventArgs e)  \n            {  \n                var fragment = this.FragmentManager.FindFragmentById(Resource.Id.frameLayout);  \n                if (fragment != null)  \n                    e.FragmentTransaction.Remove(fragment);  \n                e.FragmentTransaction.Add(Resource.Id.frameLayout, view);  \n            };  \n            tab.TabUnselected += delegate (object sender, Android.App.ActionBar.TabEventArgs e) {  \n                e.FragmentTransaction.Remove(view);  \n            };  \n  \n            this.ActionBar.AddTab(tab);  \n        }",[32,2400,2401],{},"Adding fragment classes for the end target for selecting a tab",[59,2403,2405],{"className":2404},[2112,2133],"    public class SampleTabFragment : Fragment  \n    {  \n        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)  \n        {  \n            base.OnCreateView(inflater, container, savedInstanceState);  \n  \n            var view = inflater.Inflate(Resource.Layout.Tab, container, false);  \n            var sampleTextView = view.FindViewById\u003CTextView>(Resource.Id.sampleTextView);  \n            sampleTextView.Text = \"sample fragment text\";  \n  \n            return view;  \n        }  \n    }  \n  \n    public class SampleTabFragment2 : Fragment  \n    {  \n        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)  \n        {  \n            base.OnCreateView(inflater, container, savedInstanceState);  \n  \n            var view = inflater.Inflate(Resource.Layout.Tab, container, false);  \n            var sampleTextView = view.FindViewById\u003CTextView>(Resource.Id.sampleTextView);  \n            sampleTextView.Text = \"sample fragment text 2\";  \n  \n            return view;  \n        }  \n    }",[32,2407,2408,2409,2411,2412,2415,2417,2418,2420,2421,2423],{},"When a user selects a tab, we have them hooked up to show the respective fragment.  I also noticed that the code within the TabSelected event could be replaced by the following FragmentManager code",[36,2410],{},"\ntab.TabSelected += delegate (object sender, Android.App.ActionBar.TabEventArgs e) { \u002F\u002Fvar fragment = this.FragmentManager.FindFragmentById(Resource.Id.frameLayout); \u002F\u002Fif (fragment != null) \u002F\u002Fe.FragmentTransaction.Remove(fragment); \u002F\u002Fe.FragmentTransaction.Add(Resource.Id.frameLayout, view);    ",[120,2413,2414],{}," base.FragmentManager.BeginTransaction().Replace(Resource.Id.frameLayout, view).Commit(",[36,2416],{},"\n};",[36,2419],{},"\nWhile the above works to show tabs in my sample application this is not really what I am looking for. The following guide shows the different aspects of the ActionBar.  In our above example we were working with Tab Navigation.  Ideally, what I am looking for is how to get my tabs where the action buttons are shown.",[36,2422],{},[43,2424,2426],{"href":2425},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_a3b5-image_4.png",[52,2427],{"style":395,"src":2428,"border":278,"alt":274,"title":274,"width":2429,"height":2430},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_a3b5-image_thumb_1.png",290,279,{"title":11,"searchDepth":12,"depth":12,"links":2432},[],"2016-02-06T08:02:02.1700000-05:00","More fun with actionbars with Xamarin",{},"\u002Farticles\u002Fxamarin-android-actionbar",{"title":2370,"description":2434},"articles\u002Fxamarin-android-actionbar",[18],"D9kSu3OBx2kAPQJfH-P1Y6pJDljKlYK_lEnLxL0fRJM",{"id":2442,"title":2443,"author":28,"body":2444,"createdAt":2492,"description":2448,"extension":15,"img":2487,"meta":2493,"navigation":19,"path":2494,"seo":2495,"stem":2496,"tags":2497,"updatedAt":2492,"__hash__":2498},"articles\u002Farticles\u002Fxamarin-android-listviews-part-2-of-2.md","Xamarin Android - ListViews Part 2 of 2",{"type":8,"value":2445,"toc":2490},[2446,2449,2453,2459,2463,2469,2477],[32,2447,2448],{},"Continuing on from an older post, we will modify our listview to display 2 columns.  Ultimately, we will put an image in the left column and text in the right column.  Currently we have created an ArrayAdapter which takes a list\u002Fcollection of strings and displays each row in a template.  The template was defined in a layout TextViewItem.axml",[59,2450,2452],{"className":2451},[2112,2113],"\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>  \n\u003CTextView xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"  \n    android:id=\"@+id\u002FtextItem\"  \n    android:textSize=\"44sp\"  \n    android:layout_width=\"fill_parent\"  \n    android:layout_height=\"wrap_content\" \u002F>",[32,2454,2455,2456,2458],{},"What we have was an ArrayAdapter which required the above row definition with a collection of strings.  This worked fine to display the ToString() of either the string collection you provided or the object collection you used in the definition.",[36,2457],{},"\nMoving forward this post will use a more advanced row template to display a string or an object collection.  This ultimately gives us more flexibility.  To do this we will create a custom Adapter which manages the displays aspect of the listview.  By doing this we can provide a collection of objects and then through our custom adapter we can position each property within our new row template.  Our new row template TextViewItem2.axml will be defined by the following.",[59,2460,2462],{"className":2461},[2112,2113],"\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>  \n\u003CLinearLayout xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"  \n    android:orientation=\"vertical\"  \n    android:layout_width=\"match_parent\"  \n    android:layout_height=\"match_parent\"  \n    android:minWidth=\"25px\"  \n    android:minHeight=\"25px\">  \n    \u003CLinearLayout  \n        android:orientation=\"horizontal\"  \n        android:minWidth=\"25px\"  \n        android:minHeight=\"25px\"  \n        android:layout_width=\"match_parent\"  \n        android:layout_height=\"wrap_content\"  \n        android:id=\"@+id\u002FlinearLayout1\">  \n        \u003CTextView  \n            android:id=\"@+id\u002FtextItem1\"  \n            android:textSize=\"44sp\"  \n            android:layout_width=\"wrap_content\"  \n            android:layout_height=\"fill_parent\" \u002F>  \n        \u003CTextView  \n            android:id=\"@+id\u002FtextItem2\"  \n            android:textSize=\"44sp\"  \n            android:layout_width=\"wrap_content\"  \n            android:layout_height=\"fill_parent\" \u002F>  \n    \u003C\u002FLinearLayout>  \n\u003C\u002FLinearLayout>",[32,2464,2465,2466,2468],{},"Here you can see we have a LinearLayout parent and a LinearLayout (horizontal orientation) established to display 2 textviews side by side.",[36,2467],{},"\nNow to the adapter, as mentioned above we have to build out a custom adapter as this adapter will be responsible for take each item in our collection and mapping our object properties to specific controls in the above textviewitem template.",[59,2470,2472,2473,2476],{"className":2471},[2112,2133],"   public class AboutScreenAdapter : BaseAdapter\u003CMyDetail>  \n    {  \n        List\u003CMyDetail> _items;  \n        Activity _context;  \n        public AboutScreenAdapter(Activity context, List\u003CMyDetail> items) : base()  \n        {  \n            this._context = context;  \n            this._items = items;  \n        }  \n        public override long GetItemId(int position)  \n        {  \n            return position;  \n        }  \n        public override MyDetail this[int position]  \n        {  \n            get { return _items[position]; }              \n        }  \n  \n        public override int Count  \n        {  \n            get { return _items.Count; }  \n        }  \n        public override View GetView(int position, View convertView, ViewGroup parent)  \n        {  \n            View view = convertView; \u002F\u002F re-use an existing view, if one is available  \n            if (view == null) \u002F\u002F otherwise create a new one  \n                view = _context.LayoutInflater.Inflate(Resource.Layout.",[120,2474,2475],{},"TextViewItem2",", null);  \n              \n            \u002F\u002Fview.FindViewById\u003CTextView>(Android.Resource.Id.text).Text = items[position];  \n  \n            view.FindViewById\u003CTextView>(Resource.Id.textItem1).Text = _items[position].Image;  \n            view.FindViewById\u003CTextView>(Resource.Id.textItem2).Text = _items[position].Detail;  \n            return view;  \n        }  \n    }",[32,2478,2479,2480,2482],{},"Above you can see, we provide our object collection List\u003CMyDetail> items and the row template is defined (bold) TextViewItem2 which is established by a layout in our layouts folder TextViewItem2.axml",[36,2481],{},[43,2483,2485],{"href":2484},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-listviews-part-2_6274-image_2.png",[52,2486],{"style":2259,"src":2487,"border":278,"alt":274,"title":274,"width":2488,"height":2489},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-listviews-part-2_6274-image_thumb.png",154,244,{"title":11,"searchDepth":12,"depth":12,"links":2491},[],"2016-02-01T00:32:33.2900000-05:00",{},"\u002Farticles\u002Fxamarin-android-listviews-part-2-of-2",{"title":2443,"description":2448},"articles\u002Fxamarin-android-listviews-part-2-of-2",[18],"GDfb7Zf3hkjwtI7FU52rUJ_1EeuzVTcDs_ng1XAI9yo",{"id":2500,"title":2501,"author":28,"body":2502,"createdAt":2755,"description":254,"extension":15,"img":2532,"meta":2756,"navigation":19,"path":2757,"seo":2758,"stem":2759,"tags":2760,"updatedAt":2755,"__hash__":2761},"articles\u002Farticles\u002Fxamarin-andorid-listviews-part-1-of-2.md","Xamarin Android ListViews Part 1 of 2",{"type":8,"value":2503,"toc":2753},[2504,2513,2527,2535,2538,2541,2607,2610,2684,2687,2737,2740,2751],[32,2505,2506,2507,2509,2510,2512],{},"Continuing from my drawer example code…I have a fragment (About) where I want to show a number of rows.  There are a few ways of doing this but in my case I am going to use a ListView.",[36,2508],{},"\nA ListView is an important UI component of Android applications, used everywhere from short lists of menu options to long lists of contacts or internet favorites.",[36,2511],{},"\nIn our example we have the following components that make up our Activity.",[280,2514,2515,2518,2521,2524],{},[283,2516,2517],{},"Activity the entire view",[283,2519,2520],{},"Red (our fragment)",[283,2522,2523],{},"Green (our listview)",[283,2525,2526],{},"Light Blue (our textview)",[43,2528,2530],{"href":2529},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-listviews_aae8-image_2.png",[52,2531],{"style":1279,"src":2532,"border":278,"alt":274,"title":274,"width":2533,"height":2534},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-listviews_aae8-image_thumb.png",249,404,[32,2536,2537],{},"Because we are working with Fragments we build our code within the OnCreateView method. ",[32,2539,2540],{},"I have been able to do this within OnActivityCreated as well.",[59,2542,2546],{"className":2543,"code":2544,"language":2545,"meta":11,"style":11},"language-cs shiki shiki-themes github-light github-dark","public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n{\n    string[] recs = new string[2];\n    recs[0] = \"my first row\";\n    recs[1] = \"my second row\";  \n    View view = inflater.Inflate(Resource.Layout.About, container, false);\n    \u002F\u002F_context = container.Context;             \n    var listView = view.FindViewById\u003CListView>(Resource.Id.aboutListView);\n    var adapter = new ArrayAdapter\u003Cstring>(this.Activity, Resource.Layout.TextViewItem, recs);  \u002F\u002Fyou can get context also by container.Context\n    listView.Adapter = adapter;\n    return view;\n}  \n","cs",[65,2547,2548,2553,2558,2563,2568,2573,2578,2583,2588,2593,2598,2603],{"__ignoreMap":11},[68,2549,2550],{"class":70,"line":71},[68,2551,2552],{},"public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n",[68,2554,2555],{"class":70,"line":12},[68,2556,2557],{},"{\n",[68,2559,2560],{"class":70,"line":82},[68,2561,2562],{},"    string[] recs = new string[2];\n",[68,2564,2565],{"class":70,"line":88},[68,2566,2567],{},"    recs[0] = \"my first row\";\n",[68,2569,2570],{"class":70,"line":94},[68,2571,2572],{},"    recs[1] = \"my second row\";  \n",[68,2574,2575],{"class":70,"line":584},[68,2576,2577],{},"    View view = inflater.Inflate(Resource.Layout.About, container, false);\n",[68,2579,2580],{"class":70,"line":590},[68,2581,2582],{},"    \u002F\u002F_context = container.Context;             \n",[68,2584,2585],{"class":70,"line":596},[68,2586,2587],{},"    var listView = view.FindViewById\u003CListView>(Resource.Id.aboutListView);\n",[68,2589,2590],{"class":70,"line":601},[68,2591,2592],{},"    var adapter = new ArrayAdapter\u003Cstring>(this.Activity, Resource.Layout.TextViewItem, recs);  \u002F\u002Fyou can get context also by container.Context\n",[68,2594,2595],{"class":70,"line":607},[68,2596,2597],{},"    listView.Adapter = adapter;\n",[68,2599,2600],{"class":70,"line":613},[68,2601,2602],{},"    return view;\n",[68,2604,2605],{"class":70,"line":619},[68,2606,1585],{},[32,2608,2609],{},"In this example Resource.Layout.About is the name of my Fragment (public class AboutFragment : Fragment),\nResource.Id.aboutListView is referencing the ListView that was placed in the About.axml (see below), and the Resource.Layout.TextViewItem (blue)\nrepresents each row.",[59,2611,2613],{"className":61,"code":2612,"language":63,"meta":11,"style":11},"\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003CLinearLayout xmlns:android=\"\u003Ca href=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid&quot;\">http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\u003C\u002Fa>\n    android:orientation=\"vertical\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:minWidth=\"25px\"\n    android:minHeight=\"25px\">\n    \u003CListView\n        android:minWidth=\"25px\"\n        android:minHeight=\"25px\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:id=\"@+id\u002FaboutListView\" \u002F>\n\u003C\u002FLinearLayout>\n",[65,2614,2615,2619,2624,2629,2634,2639,2644,2649,2654,2659,2664,2669,2674,2679],{"__ignoreMap":11},[68,2616,2617],{"class":70,"line":71},[68,2618,74],{},[68,2620,2621],{"class":70,"line":12},[68,2622,2623],{},"\u003CLinearLayout xmlns:android=\"\u003Ca href=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid&quot;\">http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\u003C\u002Fa>\n",[68,2625,2626],{"class":70,"line":82},[68,2627,2628],{},"    android:orientation=\"vertical\"\n",[68,2630,2631],{"class":70,"line":88},[68,2632,2633],{},"    android:layout_width=\"match_parent\"\n",[68,2635,2636],{"class":70,"line":94},[68,2637,2638],{},"    android:layout_height=\"match_parent\"\n",[68,2640,2641],{"class":70,"line":584},[68,2642,2643],{},"    android:minWidth=\"25px\"\n",[68,2645,2646],{"class":70,"line":590},[68,2647,2648],{},"    android:minHeight=\"25px\">\n",[68,2650,2651],{"class":70,"line":596},[68,2652,2653],{},"    \u003CListView\n",[68,2655,2656],{"class":70,"line":601},[68,2657,2658],{},"        android:minWidth=\"25px\"\n",[68,2660,2661],{"class":70,"line":607},[68,2662,2663],{},"        android:minHeight=\"25px\"\n",[68,2665,2666],{"class":70,"line":613},[68,2667,2668],{},"        android:layout_width=\"match_parent\"\n",[68,2670,2671],{"class":70,"line":619},[68,2672,2673],{},"        android:layout_height=\"match_parent\"\n",[68,2675,2676],{"class":70,"line":625},[68,2677,2678],{},"        android:id=\"@+id\u002FaboutListView\" \u002F>\n",[68,2680,2681],{"class":70,"line":630},[68,2682,2683],{},"\u003C\u002FLinearLayout>\n",[32,2685,2686],{},"This is another way of approaching inside the OnActivityCreated method",[59,2688,2690],{"className":2543,"code":2689,"language":2545,"meta":11,"style":11},"public override void OnActivityCreated(Bundle savedInstanceState)\n{\n    base.OnActivityCreated(savedInstanceState);    \n    string[] recs = new string[2];\n    recs[0] = \"my first row\";\n    recs[1] = \"my second row\";\n    var listView = this.Activity.FindViewById\u003CListView>(Resource.Id.aboutListView);            \n    var adapter = new ArrayAdapter\u003Cstring>(_context, Resource.Layout.TextViewItem, recs);\n    listView.Adapter = adapter;\n}  \n",[65,2691,2692,2697,2701,2706,2710,2714,2719,2724,2729,2733],{"__ignoreMap":11},[68,2693,2694],{"class":70,"line":71},[68,2695,2696],{},"public override void OnActivityCreated(Bundle savedInstanceState)\n",[68,2698,2699],{"class":70,"line":12},[68,2700,2557],{},[68,2702,2703],{"class":70,"line":82},[68,2704,2705],{},"    base.OnActivityCreated(savedInstanceState);    \n",[68,2707,2708],{"class":70,"line":88},[68,2709,2562],{},[68,2711,2712],{"class":70,"line":94},[68,2713,2567],{},[68,2715,2716],{"class":70,"line":584},[68,2717,2718],{},"    recs[1] = \"my second row\";\n",[68,2720,2721],{"class":70,"line":590},[68,2722,2723],{},"    var listView = this.Activity.FindViewById\u003CListView>(Resource.Id.aboutListView);            \n",[68,2725,2726],{"class":70,"line":596},[68,2727,2728],{},"    var adapter = new ArrayAdapter\u003Cstring>(_context, Resource.Layout.TextViewItem, recs);\n",[68,2730,2731],{"class":70,"line":601},[68,2732,2597],{},[68,2734,2735],{"class":70,"line":607},[68,2736,1585],{},[32,2738,2739],{},"TextViewItem.axml",[32,2741,2742,2743,2746,2750],{},"\u003CTextView xmlns:android=\"",[43,2744],{"href":2745},"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"",[43,2747,2748],{"href":2748,"rel":2749},"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid",[408],"\"\n    android:id=\"@+id\u002FtextItem\"\n    android:textSize=\"44sp\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"wrap_content\" \u002F>",[237,2752,239],{},{"title":11,"searchDepth":12,"depth":12,"links":2754},[],"2016-01-31T05:38:21.5000000-05:00",{},"\u002Farticles\u002Fxamarin-andorid-listviews-part-1-of-2",{"title":2501,"description":254},"articles\u002Fxamarin-andorid-listviews-part-1-of-2",[18],"JuRG_Zcn0MsuFdCH2GNMKvH012bu4uX_lZwaO7XegO4",{"id":2763,"title":2764,"author":28,"body":2765,"createdAt":3004,"description":3005,"extension":15,"img":2814,"meta":3006,"navigation":19,"path":3007,"seo":3008,"stem":3009,"tags":3010,"updatedAt":3004,"__hash__":3011},"articles\u002Farticles\u002Fxamarin-android-drawerlayout.md","Xamarin Android - DrawerLayout",{"type":8,"value":2766,"toc":3002},[2767,2862,2906,2945],[32,2768,2769,2770,2774,2775,2777,2778,2780,2781,2783,2786,2787,2789,2790,2792,2793,2795,2796,2798,2799,2801,2802,2806,2807,2809,2817,2819,2820,2822,2823,2825,2826,2828,2829,2831,2832,2834,2835,2837,1414,2843,2849,2851,2852,2854,2855,2857,2858,2861],{},"To add a navigation drawer, declare your user interface with a ",[43,2771,2773],{"href":2772},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv4\u002Fwidget\u002FDrawerLayout.html","DrawerLayout"," object as the root view of your layout. Inside the ",[43,2776,2773],{"href":2772},", add one view that contains the main content for the screen (your primary layout when the drawer is hidden) and another view that contains the contents of the navigation drawer.",[36,2779],{},"\n\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003Candroid.support.v4.widget.DrawerLayout\nxmlns:android=\"",[43,2782],{"href":2748},[43,2784,2748],{"href":2748,"rel":2785},[408],"\"\nandroid:id=\"@+id\u002FdrawerLayout\"\n   android:layout_width =\"match_parent\"\n    android:layout_height=\"match_parent\">",[36,2788],{},"\n  \u003C!-- Content -->\n  \u003CFrameLayout\n        android:id =\"@+id\u002FframeLayout\"\n        android:layout_width =\"match_parent\"\n        android:layout_height=\"match_parent\" \u002F>",[36,2791],{},"\n  \u003C!-- Navigation drawer menu -->\n  \u003CListView\n        android:id=\"@+id\u002FdrawerListView\"\n        android:layout_gravity=\"start\"\n        android:choiceMode    =\"singleChoice\"\n        android:layout_width  =\"240dp\"\n        android:layout_height =\"match_parent\"\n        android:background =\"?android:attr\u002FwindowBackground\" \u002F>",[36,2794],{},"\n\u003C\u002Fandroid.support.v4.widget.DrawerLayout>",[36,2797],{},"\nThe above layout uses a DrawerLayout with two child views: a FrameLayout to contain the main content which will be populated with a Fragment at runtime, and a ListView for the contents of the drawer.",[36,2800],{},"\nNow to the MainActivity.cs coding.. let’s get a reference to the drawerLayout = FindViewById\u003CDrawerLayout>(Resource.Id.drawerLayout);  You will find that DrawerLayout is not defined.  You need to add a reference via Nuget to ",[43,2803,2805],{"href":2804,"target":46},"https:\u002F\u002Fcomponents.xamarin.com\u002Fview\u002Fxamandroidsupportv4-18","Android Support Library v4",".  Open Nuget and search for Xamarin.android.support.v4",[36,2808],{},[43,2810,2812],{"href":2811},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_2.png",[52,2813],{"style":395,"src":2814,"border":278,"alt":274,"title":274,"width":2815,"height":2816},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb.png",374,106,[36,2818],{},"\nAndroid Support Libraries : The Android Support Libraries are a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running older versions of Android.  Including the Support Libraries in your Android project is considered a best practice for application developers.",[36,2821],{},"\nAdding a using statement for Android.Support.V4.Widget will complete the reference to DrawerLayout.",[36,2824],{},"\n_menuItems = new string",[68,2827],{}," { \"Welcome\", \"Options\", \"About\" };\n_drawerLayout = FindViewById\u003CDrawerLayout>(Resource.Id.drawerLayout);\n_drawerList = FindViewById\u003CListView>(Resource.Id.drawerListView);\n_drawerList.Adapter = new ArrayAdapter\u003Cstring>(this, Resource.Layout.ListViewMenuRow, Resource.Id.menuRowTextView, _menuItems);",[36,2830],{},"\nWe have a List which should be populated by an Adapter (ArrayAdapter or SimplerCursorAdaptor)",[36,2833],{},"\nAt this point we have (left) and if you swipe toward the right you see the menu.",[36,2836],{},[43,2838,2840],{"href":2839},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_4.png",[52,2841],{"style":395,"src":2842,"border":278,"alt":274,"title":274,"width":2384,"height":521},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_1.png",[43,2844,2846],{"href":2845},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_6.png",[52,2847],{"style":2259,"src":2848,"border":278,"alt":274,"title":274,"width":2384,"height":2489},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_2.png",[36,2850],{},"\nHooking up the menu click looks like..",[36,2853],{},"\n_drawerList.ItemClick += _drawerList_ItemClick;",[36,2856],{},"\nprivate void _drawerList_ItemClick(object sender, AdapterView.ItemClickEventArgs e)\n{\n    OnMenuItemClick(e.Position);\n}private void OnMenuItemClick(int position)\n{\n    this.Title = _menuItems",[68,2859,2860],{},"position",";\n}",[32,2863,2864,2865,2867,2868,2861,2870,2872,2873,2877,2878,2882,2883,149,2887,2891,2893,2894,2896,2897,2899,2900,2902,2903,2905],{},"If you want to use lambda the above can be rewritten..",[36,2866],{},"\n_drawerList.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => OnMenuItemClick(e.Position);\nprivate void OnMenuItemClick(int position)\n{\n    this.Title = _menuItems",[68,2869,2860],{},[36,2871],{},"\nNow we have to deal with showing a view after clicking a menu item.  We will do this implementation with Fragments.  A Fragment is a piece of an application's user interface or behavior that can be placed in an ",[43,2874,2876],{"href":2875},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fapp\u002FActivity.html","Activity",". Interaction with fragments is done through ",[43,2879,2881],{"href":2880},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fapp\u002FFragmentManager.html","FragmentManager",", which can be obtained via ",[43,2884,2886],{"href":2885},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fapp\u002FActivity.html#getFragmentManager()","Activity.getFragmentManager()",[43,2888,2890],{"href":2889},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fapp\u002FFragment.html#getFragmentManager()","Fragment.getFragmentManager()",[36,2892],{},"\nAt this point, we declare field parameter Fragment",[68,2895],{}," _fragments\nprivate Fragment",[68,2898],{}," _fragments = new Fragment",[68,2901],{},"{ new WelcomeFragment(), new OptionsFragment(), new AboutFragment() };",[36,2904],{},"\nand within the menu click, use the FragmentManager to set the selected fragment using the position in the array.",[32,2907,2908,2909,2911,2912,2914,2915,2917,2918,2920,2921,2923,2924,2928,2929,2931,2932,2934,2942,2944],{},"private void OnMenuItemClick(int position)\n{\n    base.FragmentManager.BeginTransaction().Replace(Resource.Id.frameLayout, _fragments",[68,2910,2860],{},").Commit();\n    this.Title = _menuItems",[68,2913,2860],{},";\n}\nOk, so running the sample now we have a drawer menu, and when an item is selected we use FragmentManager to swap out the frameLayout view with a fragment defined in the _fragments array.  As the application starts we want to set the first menu item selected and we want to show the respective fragment via",[36,2916],{},"\n_drawerList.SetItemChecked(0, true); \u002F\u002Fhighlight the first item at startup\nOnMenuItemClick(0);",[36,2919],{},"\nAfter the menu item is selected, we swap fragments and we will also close the drawer via\n_drawerLayout.CloseDrawer(_drawerList);",[36,2922],{},"\nIf you review the screen captures above you will notice we do not yet have the hamburger menu.  We will do this by working with the ActionBar.  Using the class ",[43,2925,2927],{"href":2926,"target":46},"http:\u002F\u002Fdeveloper.xamarin.com\u002Fapi\u002Ftype\u002FAndroid.Support.V4.App.ActionBarDrawerToggle\u002F","ActionBarDrawerToggle"," we can tie together the functionality of DrawerLayout and the framework ActionBar to implement the recommended design for navigation drawers.",[36,2930],{},"\nSo, I did have a few conflicts at this point which brings up Android.Support.V7.App vs. Android.Support.V4.App.  What is the difference? V4 supports library is designed to be used with Android 1.6 (API level 4) while V7 supports “libraries designed to be used with Android 2.1 (API level 7) and higher”  We will need to add via Nuget Xamarin.Android.Support.v7.AppCompat to reference ActionBarDrawerToggle.  i.e. Android.Support.V7.App.ActionBarDrawerToggle",[36,2933],{},[43,2935,2937],{"href":2936},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_8.png",[52,2938],{"style":395,"src":2939,"border":278,"alt":274,"title":274,"width":2940,"height":2941},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_3.png",342,100,[36,2943],{},"\nWithin v7 Support Library there are several libraries with a number of feature sets which can be included independently of each other.  For example within v7 we have v7 appcompat library, v7 cardview library, v7 gridlayout library etc.",[32,2946,2947,2948,2950,2951,2954,2955,1209,2957,2959,2960,2964,2965,2967,2968,1209,2970,2972,1414,2979,2987,2989,2990,2992,2993,2995,2996,2998,2999,3001],{},"\u002F\u002Fcreate an instance of actionbardrawertoggle           \n_drawerToggle = new ActionBarDrawerToggle(this, _drawerLayout, Resource.String.DrawerOpenDescription, Resource.String.DrawerCloseDescription);\n\u002F\u002Fset the actiondrawertoggle as the drawerlistener on the drawlayout so it recieves drawer state-change callbacks\n_drawerLayout.SetDrawerListener(_drawerToggle);\n\u002F\u002FMust up-enable the home button, the ActionBarDrawerToggle will change the icon to the \"hamburger\"\nActionBar.SetDisplayHomeAsUpEnabled(true);",[36,2949],{},"\nBuilding the project I do have an issue….”",[120,2952,2953],{},"No resource identifier found for attribute ‘touchscreenBlocksFocus’ in the package ‘android’ ","After more than 1 hour of searching I came along the solution.  I had ‘Compile using Android version:’ API Level 19, Minimum Android to target: Use Compile using SDK Version, Target Android: ‘'Use Compile Using SDK Version.  In order to avoid this error I had to change my Target Android version to API Level 21 (Xamarin.Android v5.0 Support).",[36,2956],{},[36,2958],{},"\nSo that brings up the question\u002Fconcern, for Android applications you have the choices Compile Using, Minimum Android to target, and Target Android version.  So what is the difference here.  From ",[43,2961,2963],{"href":2962,"target":46},"http:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F4568267\u002Fandroid-min-sdk-version-vs-target-sdk-version\u002F4994039#4994039","StackOverflow"," a very good explanation (partial)\n”In short, here is the purpose to declaring a different targetSDK from the minSDK: It means you are using features from a higher level SDK than your minimum, but you have ensured backwards compatibility. In other words, imagine that you want to use a feature that was only recently introduced, but that isn't critical to your application. You would then set the targetSDK to the version where this new feature was introduced and the minimum to something lower so that everyone could still use your app.”",[36,2966],{},"\nGetting back on track, we were hooking up the action bar to that of the drawer. Before we hook up this action bar drawer toggle we have this (left) notice there is no icon.  After we hook up the drawertoggle we have the \u003C icon.",[36,2969],{},[36,2971],{},[43,2973,2975],{"href":2974},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_14.png",[52,2976],{"style":395,"src":2977,"border":278,"alt":274,"title":274,"width":2978,"height":521},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_6.png",150,[43,2980,2982],{"href":2981},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_10.png",[52,2983],{"style":395,"src":2984,"border":278,"alt":274,"title":274,"width":2985,"height":2986},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_4.png",152,242,[36,2988],{},"\nNow when a user clicks on the > icon we want to forward all actionbar clicks to the ActionBarDrawerToggle.  We can do this with",[36,2991],{},"\npublic override bool OnOptionsItemSelected(IMenuItem item)\n{\n    \u002F\u002F Forward all ActionBar-clicks to the ActionBarDrawerToggle.\n    \u002F\u002F It will verify the click was on the \"Home\" button (i.e. the button at the left edge of the ActionBar).\n    \u002F\u002F If so, it will toggle the state of the drawer. It will then return \"true\" so you know you do not need to do any more processing.\n    if (_drawerToggle.OnOptionsItemSelected(item))\n        return true;\n    \u002F\u002F Other cases go here for other buttons in the ActionBar.\n    \u002F\u002F This sample app has no other buttons. This code is a placeholder to show what would be needed if there were other buttons.\n    switch (item.ItemId)\n    {\n        default: break;\n    }    return base.OnOptionsItemSelected(item);\n}",[36,2994],{},"\nThe final piece of this is ensuring that the hamburger is shown when the menu is closed.  In order to do this we need to sync the state of the drawer via the following method.  This will execute after your activities initialization is finished.  You need to tell the toggle button to synchronize its icon with the open\u002Fclosed state of the drawer.",[36,2997],{},"\nprotected override void OnPostCreate(Bundle savedInstanceState)\n{\n    \u002F\u002F Initialization and any needed Restore operation are now complete.\n    \u002F\u002F Sync the state of the ActionBarDrawerToggle to the drawer (i.e. show the \"hamburger\" if the drawer is closed or an arrow if it is open).\n     _drawerToggle.SyncState();\n    base.OnPostCreate(savedInstanceState);\n}",[36,3000],{},"\nIf you would like the sample code, please connect with me via email or twitter and I will send to you.",{"title":11,"searchDepth":12,"depth":12,"links":3003},[],"2016-01-30T08:45:55.4700000-05:00","To add a navigation drawer, declare your user interface with a DrawerLayout object as the root view of your layout. Inside the DrawerLayout, add one view that contains the main content for the screen (your primary layout when the drawer is hidden) and another view that contains the contents of the navigation drawer.\n\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003Candroid.support.v4.widget.DrawerLayout\nxmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\nandroid:id=\"@+id\u002FdrawerLayout\"\n   android:layout_width =\"match_parent\"\n    android:layout_height=\"match_parent\">\n  \u003C!-- Content -->\n  \u003CFrameLayout\n        android:id =\"@+id\u002FframeLayout\"\n        android:layout_width =\"match_parent\"\n        android:layout_height=\"match_parent\" \u002F>\n  \u003C!-- Navigation drawer menu -->\n  \u003CListView\n        android:id=\"@+id\u002FdrawerListView\"\n        android:layout_gravity=\"start\"\n        android:choiceMode    =\"singleChoice\"\n        android:layout_width  =\"240dp\"\n        android:layout_height =\"match_parent\"\n        android:background =\"?android:attr\u002FwindowBackground\" \u002F>\n\u003C\u002Fandroid.support.v4.widget.DrawerLayout>\nThe above layout uses a DrawerLayout with two child views: a FrameLayout to contain the main content which will be populated with a Fragment at runtime, and a ListView for the contents of the drawer.\nNow to the MainActivity.cs coding.. let’s get a reference to the drawerLayout = FindViewById\u003CDrawerLayout>(Resource.Id.drawerLayout);  You will find that DrawerLayout is not defined.  You need to add a reference via Nuget to Android Support Library v4.  Open Nuget and search for Xamarin.android.support.v4\nAndroid Support Libraries : The Android Support Libraries are a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running older versions of Android.  Including the Support Libraries in your Android project is considered a best practice for application developers.\nAdding a using statement for Android.Support.V4.Widget will complete the reference to DrawerLayout.\n_menuItems = new string { \"Welcome\", \"Options\", \"About\" };\n_drawerLayout = FindViewById\u003CDrawerLayout>(Resource.Id.drawerLayout);\n_drawerList = FindViewById\u003CListView>(Resource.Id.drawerListView);\n_drawerList.Adapter = new ArrayAdapter\u003Cstring>(this, Resource.Layout.ListViewMenuRow, Resource.Id.menuRowTextView, _menuItems);\nWe have a List which should be populated by an Adapter (ArrayAdapter or SimplerCursorAdaptor)\nAt this point we have (left) and if you swipe toward the right you see the menu. \nHooking up the menu click looks like..\n_drawerList.ItemClick += _drawerList_ItemClick;\nprivate void _drawerList_ItemClick(object sender, AdapterView.ItemClickEventArgs e)\n{\n    OnMenuItemClick(e.Position);\n}private void OnMenuItemClick(int position)\n{\n    this.Title = _menuItemsposition;\n}",{},"\u002Farticles\u002Fxamarin-android-drawerlayout",{"title":2764,"description":3005},"articles\u002Fxamarin-android-drawerlayout",[18],"atMZSxAPcEHLtAMZGtRMESx9f019pOvMhwLgqyfRYSM",{"id":3013,"title":3014,"author":28,"body":3015,"createdAt":3103,"description":254,"extension":15,"img":3049,"meta":3104,"navigation":19,"path":3105,"seo":3106,"stem":3107,"tags":3108,"updatedAt":3103,"__hash__":3109},"articles\u002Farticles\u002Fxamarin-android-player-improving-performance.md","Xamarin Android Player Improving Performance",{"type":8,"value":3016,"toc":3101},[3017,3030,3041,3052,3063],[32,3018,3019,3020,3022,3023,115,3027,3029],{},"Currently, using Windows 8.1 x64, Visual Studio 2015, Oracle VM VirtualBox Manager (Ver 5.0.4r102546)",[36,3021],{},"\nWith Xamarin Android Player ",[43,3024,3026],{"href":3025,"target":46},"http:\u002F\u002Fdeveloper.xamarin.com\u002Fguides\u002Fandroid\u002Fgetting_started\u002Finstallation\u002Fandroid-player\u002F","installed",[36,3028],{},"\nDisable Windows HyperV",[280,3031,3032,3035,3038],{},[283,3033,3034],{},"Programs and Features – Turn Windows features on and off",[283,3036,3037],{},"Expand Hyper-V",[283,3039,3040],{},"Uncheck it (may require windows restart)",[32,3042,3043,3044],{},"Start Oracle VM VirtualBox (select device), ",[43,3045,3047],{"href":3046},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-playerimproving-performa_e20e-image_10.png",[52,3048],{"style":2259,"src":3049,"border":278,"alt":274,"title":274,"width":3050,"height":3051},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-playerimproving-performa_e20e-image_thumb_4.png",93,96,[280,3053,3054,3057,3060],{},[283,3055,3056],{},"Right click – Settings",[283,3058,3059],{},"System – Acceleration – Hardware Virtualization – Enable VT-x\u002FAMD-V (Check On)",[283,3061,3062],{},"Display – Video Memory (increase from the default 1mb to 50mb)",[32,3064,1414,3065,3067,3068,1209,3070,1209,3072,3079,1209,3081,3083,3090,1209,3092,3094],{},[36,3066],{},"\nFrom Xamarin also, the Xamarin Android Player emulated device will run significantly faster if your CPU supports hardware-assisted virtualization, and this is enabled in the BIOS. If your CPU supports this, please ensure it is enabled by booting your PC into the system BIOS, and checking for an option named \"Hardware virtualization”, \"VT-x”, \"AMD-V” or similar.",[36,3069],{},[36,3071],{},[43,3073,3075],{"href":3074},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-playerimproving-performa_e20e-image_2.png",[52,3076],{"style":2259,"src":3077,"border":278,"alt":274,"title":274,"width":3078,"height":2489},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-playerimproving-performa_e20e-image_thumb.png",177,[36,3080],{},[36,3082],{},[43,3084,3086],{"href":3085},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-playerimproving-performa_e20e-image_4.png",[52,3087],{"style":2259,"src":3088,"border":278,"alt":274,"title":274,"width":2489,"height":3089},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-playerimproving-performa_e20e-image_thumb_1.png",208,[36,3091],{},[36,3093],{},[43,3095,3097],{"href":3096},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-playerimproving-performa_e20e-image_6.png",[52,3098],{"style":2259,"src":3099,"border":278,"alt":274,"title":274,"width":2489,"height":3100},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-playerimproving-performa_e20e-image_thumb_2.png",163,{"title":11,"searchDepth":12,"depth":12,"links":3102},[],"2016-01-15T09:19:49.0200000-05:00",{},"\u002Farticles\u002Fxamarin-android-player-improving-performance",{"title":3014,"description":254},"articles\u002Fxamarin-android-player-improving-performance",[18],"knCQH-0JchtNgJ4YV1noWWF56CORbMkCB5mhGHOaZd0",1781574760939]