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

Count is assigned but its value is never used (CS0414) (hello_world)

$
0
0

Hi for all,

I am a noob. i start with this new (for me) adventure of app mobile with xamarin. In start project "Hello_World", have a problem: The field Hello_World.Activity1.count is assigned but its value is never used (CS0414) (hello_world)

the code is as follow:

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace Hello_World
{
    [Activity (Label = "Hello_World", MainLauncher = true)]
    public class MainActivity : Activity
    {
        int count = 1;

        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);
            //create the user interface in code
            var layout = new LinearLayout (this);
            layout.Orientation = Orientation.Vertical;

            var aLabel = new TextView (this);
            aLabel.Text = "Hello_World, Xamarin.Android";

            var aButton = new Button (this);
            aButton.Text = "Say Hello";

            aButton.Click += (sender, e) => {
                aLabel.Text = "Hello from the button";
            };
            layout.AddView (aLabel);
            layout.AddView (aButton);
            SetContentView (layout);
        }

        //protected override void OnCreate (Bundle bundle)
        //{
            //base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            //SetContentView (Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            //Button button = FindViewById

any ideas for to solve this 'warning'?

Thanks a lot


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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