O'Reilly logo

Xamarin Studio for Android Programming: A C# Cookbook by Mathieu Nayrolles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Solving equations

In this third recipe, we will create a new activity responsible for displaying an equation and checking the answer.

How to do it...

We will now see how to solve the equations:

  1. Create a new activity named EquationActivity and make it look like the following:
    namespace TheInternship { [Activity (Label = "EquationActivity")] public class EquationActivity : Activity { Dictionary<String, int> equations = new Dictionary<string, int> (); KeyValuePair<String, int> current_equation; protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Equation); // Add some basic equations in our Dictionary of equation equations.Add ("2+2", 4); equations.Add ("4/2", 2); equations.Add ("3*3", 9); equations.Add ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required