Try moving the calculation part to another class and calling a method on that class... When you run into specific problems, then you can ask questions.
---------------------------------------------------------------------- There are only 10 types of people in the world... Those who know binary and those who don't. ---------------------------------------------------------------------- On Wed, Feb 10, 2010 at 2:05 PM, ckloch <[email protected]> wrote: > It is great to see that there is a group for Android beginners. > > I am trying to get some experience with Android. > One of the things I have tried doing most of the day is call a class. > Currently, the program is doing fine with only one class, but it will > be great to move the calculation part to a separate class and then > return the results. This means that the lines from the code below > should be moved to a separate class; > // calculate the result > Time_from_start = 20; > Time_to_arrival = 2; > Arrival_time = Time_from_start+Tiime_to_arrival; > > > The working code looks like this: > > package ti.igts.greenwave; > > import android.app.Activity; > import android.os.Bundle; > import java.text.NumberFormat; > import ti.igts.greenwave.R; > import android.util.Log; > import android.view.View; > import android.widget.Button; > import android.widget.EditText; > import android.widget.TextView; > > public class GreenWave extends Activity { > /** Called when the activity is first created. */ > public float Time_from_start; > public float Time_to_arrival; > public float Arrival_time; > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > > setContentView(R.layout.welcomemain); > > final TextView answerfield = (TextView) > findViewById(R.id.answer); > String answer = ""; > > NumberFormat nf = java.text.NumberFormat.getNumberInstance(); > > // calculate the result > Time_from_start = 20; > Time_to_arrival = 2; > Arrival_time = Time_from_start+Time_to_arrival; > answer = "Time of Arrival " + nf.format(Arrival_time); > // display the answer > answerfield.setText(answer); > > } > > } > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > To unsubscribe from this group, send email to > [email protected]<android-beginners%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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

