battle programmers alliance

battle programminga forum for elite programmerswith extreme will powerto sharpen theire skills
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in
Search
 
 

Display results as :
 
Rechercher Advanced Search
Latest topics
» android mobile app dev APK
Yesterday at 10:01 pm by Moti Barski

» battle programmers alliance new features :
Yesterday at 5:25 pm by Admin

» urban prepper grimoire
Sat Aug 18, 2018 1:03 pm by Moti Barski

» broadcast receiver dead
Sat Aug 04, 2018 7:51 am by Moti Barski

» programming tool : find dif between 2 texts
Tue Jul 31, 2018 6:32 am by Moti Barski

» java class that filter numbers out of a string
Mon Jul 30, 2018 11:20 am by Moti Barski

» android studio execises
Mon Jul 09, 2018 1:43 pm by Moti Barski

» problem with firebase authentication
Thu Jun 28, 2018 9:52 am by Moti Barski

» text art canvas
Wed Jun 20, 2018 8:55 pm by Moti Barski

August 2018
SunMonTueWedThuFriSat
   1234
567891011
12131415161718
19202122232425
262728293031 
CalendarCalendar
Social bookmarking
Social bookmarking digg  Social bookmarking delicious  Social bookmarking reddit  Social bookmarking stumbleupon  Social bookmarking slashdot  Social bookmarking yahoo  Social bookmarking google  Social bookmarking blogmarks  Social bookmarking live      

Bookmark and share the address of battle programmers alliance on your social bookmarking website
Share | 
 

 visual studio 2017 xamarin c# hello world walkthrough

Go down 
AuthorMessage
Moti Barski

avatar

Posts : 177
Join date : 2011-08-02

PostSubject: visual studio 2017 xamarin c# hello world walkthrough   Sat May 13, 2017 11:37 am

install visual studio with c# and xamarin checked, if you already have VS DL xamarin.

open your mobil device for developing search the walkthrough for your phone.

in the now visible phone developer options (on your phone), enable usb debugging

new project, c#, android, single view app
from solution explore, resources, layout, main xml, drag add button from the toolbox, save

from main.cs of solution explorer right side window : main.cs

add code :
Button button1 = FindViewById<Button>(Resource.Id.button1);

           button1.Click += delegate { button.Text = string.Format("hello world"); };

now your code is :
Code:
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace App8
{
    [Activity(Label = "App8", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        int count = 1;

        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<Button>(Resource.Id.MyButton);

            button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
            // and attach an event to it
            Button button1 = FindViewById<Button>(Resource.Id.button1);

            button1.Click += delegate { button.Text = string.Format("hello world"); };
        }
    }
}
connect phone , click green arrow or f5

example for textview widget + button :
Code:
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace App8
{
    [Activity(Label = "App8", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        int count = 1;

        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<Button>(Resource.Id.MyButton);

            button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
            // and attach an event to it
            Button button1 = FindViewById<Button>(Resource.Id.button1);
            TextView text1 = FindViewById<TextView>(Resource.Id.textView1);
            button1.Click += delegate { text1.Text = "hello world"; };
        }
    }
}


_________________
MB over and out _______________________     
Back to top Go down
View user profile Online
Moti Barski

avatar

Posts : 177
Join date : 2011-08-02

PostSubject: Re: visual studio 2017 xamarin c# hello world walkthrough   Sat May 13, 2017 4:55 pm

after you finish debugging and unplug your mobile device turn off the developer options or your B8Tri will deplete very fast

_________________
MB over and out _______________________     
Back to top Go down
View user profile Online
Admin
Admin
avatar

Posts : 113
Join date : 2011-08-01

PostSubject: displaying a message   Sat Jul 29, 2017 11:34 am

this is a faster way to display a message, use the toast message display spell :
Code:
Toast.MakeText(this, "hello world", ToastLength.Short).Show();
:albino: :albino: :albino: :albino: :albino:

_________________
kurayami no kagi  _____    
Back to top Go down
View user profile http://yotamarker.forumotion.com
 
visual studio 2017 xamarin c# hello world walkthrough
Back to top 
Page 1 of 1
 Similar topics
-
» Setting Up Webdriver in Visual Studio
» making a selenium framework in eclipse(java environment). previously used visual studio.
» The World at War - The Desert North Africa (1973) DVDRip x264
» Portuguese pool is among most beautiful in world
» Visual aura seems to be repeating over and over...this is new!

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: battle programming-
Jump to: