Bug 57118 - [Anndroid] Blank app template has SetCOntentView commented out in MainActivity.OnCreate
Summary: [Anndroid] Blank app template has SetCOntentView commented out in MainActivit...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Templates ()
Version: 4.5.0 (15.2)
Hardware: PC Windows
: --- enhancement
Target Milestone: 15.3
Assignee: Pierce Boggan [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-06-02 20:14 UTC by Jon Goldberger [MSFT]
Modified: 2017-07-12 11:55 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Jon Goldberger [MSFT] 2017-06-02 20:14:49 UTC
## Description

The Blank App template for Android has the SetContentView(...) call commented out in MainActivity.OnCreate. If you are providing a Main.axml file then I feel that line of code should be left in. It might confuse someone who opens the Blank App, edits the Main.axml file to add controls and then deploys the app only to see no UI.


In addition the Blank App template on Visual Studio for Mac / Xamarin Studio not only has the SetContentView uncommented, it has a button with a click handler to count button clicks, identical to the Single View App template in Visual Studio (Windows). There should be parity. 

My thought is that either:
1. the Blank App template should be removed from VS Windows, and in VS for Mac the Blank App template should be renamed to Single View App, achieving parity between the ide templates. Then if you want to provide a truly blank app template, make it truly blank, no Main.xml by default, no code in MainActivity.OnCreate, etc. 
or
2. change the Blank App template in VS Windows so the SetContentView call is not commented out. Then in VS for Mac, rename the Blank App template to Single View app and add a Blank App template to match the Blank app template in VS WIndows, thus also achieving parity between the IDEs.
Comment 2 Pierce Boggan [MSFT] 2017-06-08 20:21:07 UTC
This is fixed in the d15-3 branch, and should be included in the next release:
https://github.com/xamarin/XamarinVS/blob/d15-3/src/Features/VisualStudio.Templates/T/PT/CSharp/Android/AndroidBlankApp/ActivityBlankApp.cs

Thanks again for letting us know @Jon Goldberger!