You might want to look at Mark Murphy's tutorials on AndroidGuys.com
as well as some of the samples codes in the SDK.

To sumarize the workflow, I'd say:

- in your activity onCreate, you want to get objects corresponding to
your UI widgets, e.g.:

  EditText theInputField = (EditText) findViewById(R.id.id_of_the_input_field);
  Button theButton = (Button) findViewById(R.id.calculate_button);

- associate a callback to your button. If the code is small, you can
use an anonymous listener (e.g. a class defined in-line in the
callback set call) or define a separate class and link it. The most
simple instance will look something like this:

  theButton..setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
           // read your input field:
           String field1 = theInputField.getText();
           int value = Integer.intVal(field); // make sure to catch exceptions
           // prepare result
           String result = Integer.toString(4 * value);
          someTextField.setText(text);
        }
        });

That should get you started.

For starting I suggest you use Eclipse as you can get tooltip help for
methods, arguments and auto-completion to help your learn the API very
quickly.

Feel free to ask more detailed questions.

HTH
R/

On Tue, Dec 30, 2008 at 9:28 AM, Fender <[email protected]> wrote:
>
> OK, so im starting to get the hang of things with android. XML wise, i
> get it. Its the java side that im currently struggling with. For a
> test app, im trying to do something very simple.
>
> Create a field and a radio box with a value (an empty field, then a
> radio group with like 1, 2, 3, 4, etc.). That i can do.
>
> Now, i want my app to be able to define the inputs as variables. AKA
> Whatever is put into the field is stored as fieldvariable, then
> whatever number is selected is stored as selectednumber or something,
> then i want to be able to do some basic math with it, and display the
> answer. For example, i type 4 in the field, i select 1 from the radio
> group, then hit a button that says calculate, and the answer is
> displayed.
>
> XML wise, i get it. I can create a field for numbers only, i can
> create the radiobox no problem, its the java side i dont get. Would
> someone be kind enough to show me what java id have to use, and break
> down the different parts for me? Id GREATLY appreciate it.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to