Skip to main content

Alert dialog for Xamarin Android

So it occurred to me this weekend that I have been working on a project these past couple months but haven't posted any videos. Partially, this is a private project so I won't publish the code at all. The more pressing reason is I'm really learning myself as I go so it really isn't pretty.

That being said, I considered posting some code to some of my biggest road blocks but felt that might slow down my progress. I've begun helping a friend who is new to coding and realized that it is beneficial to myself to write up and be able to share/teach those coming behind me.

I will be using the label android snippets to keep my notes in regards to this Xamarin Android application. I'll add a shortcut link in the blog soon. Here's the most recent headache I had.

I will look into possibly creating a class out of some of these snippets for myself.

Alert dialog for Xamarin Android:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
       AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.SetTitle("Log out");
            alert.SetMessage("Are you sure?");
            alert.SetPositiveButton("Yes", (senderAlert, args) =>
            {
              // actions for a yes click
              // example here begins new activity
              StartActivity(typeof(LoginActivity));
            });
            alert.SetNegativeButton("No", (senderAlert, args) =>
            { 
              // action for no click
            });
            Dialog dialog = alert.Create();
            dialog.Show();

Alert Dialog for Xamarin Android
Please feel free to leave comments or contact me with any questions.

Comments

Popular posts from this blog

Sending SMS via code (.Net, c#)

Stream Our Mistakes EP 001 --- In this episode, we will work on sending SMS messages via code using twilio. The example said it could be done in 30 seconds but it took us closer to an hour. Browse the code, fork the repo to get ready for our next steps. https://github.com/mmdempsey/SMS-Automation Subscribe to the podcast on itunes , google play ,   stitcher | eddyizm site: http://eddyizm.com twitter: http://twitter.com/eddyizm github: https://github.com/eddyizm matt site: http://octon.io/ github: https://github.com/mmdempsey --- **Tool of the week:** https://technet.microsoft.com/en-us/sysinternals/zoomit.aspx --- **youtube live broadcast:** https://youtube.com/user/eddyizm/live Subscribe to our channel and follow my twitter feed to be notified of our next live broadcast and feel free to leave us comments and suggestions on what you want to see. ---

004 - HTML Scraping with Beautiful Soup

Stream Our Mistakes EP 004 In this episode, Matt walks us through html/web scraping using the popular python library, Beautiful Soup. Here's the code snippet from the session and links: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 # Created for Stream Our Mistakes # https://streamourmistakes.blogspot.com/ # Reference: # https://docs.python.org/3/library/urllib.request.html # https://www.crummy.com/software/BeautifulSoup/bs4/doc/ from bs4 import BeautifulSoup import urllib.request ''' # local html to play with from documentation Uncomment to enable html_doc = """ <html><head><title>The Dormouse's story</title></head> <body> <p class="title"><b>The Dormouse's story</b></p> <p class="story">Once upon a time there were three little sister...

RSS feed is retired

Well, It seems this idea never really took off. So I'll just be posting directly to youtube and twitch. Here's the stream my mistakes playlist that I will add technical videos to: https://www.youtube.com/playlist?list=PLO7cwisTbrI0r238JqxcTZdFpf6d847YE