Saturday, May 14, 2011

Addition in Android development

Recently, I created a blog post on basic math in iPhone development, so I figured why not do the same for Android programming. Basically, you need to create two editText fields, a textView and a button. Below is an example of source code that could be used within the button method to add two numbers.

String s1,s2;
Integer v;

s1 = edit1.getText().toString();
s2 =edit2.getText().toString();
v = Integer.parseInt(s1) + Integer.parseInt(s2);

textview1.setText(v);

Recently, I created a World War II trivia game for iPhone. It's called CODENAME:WW2 Trivia. If you're interested in downloading, click here.

No comments:

Post a Comment