First thing I noticed right off the bat is that you aren't checking for the case where the input can't be parsed to a double... That throws an exception and since you aren't handling that that would crash your app.
Second thing I noticed is that hideous @SuppressWarnings thing.... In my opinion if you need to do that then you need to rethink what you are doing. Last, but not least, check the logcat output when you get a crash... it will tell you more about why it is crashing. ---------------------------------------------------------------------- There are only 10 types of people in the world... Those who know binary and those who don't. ---------------------------------------------------------------------- On Tue, Apr 20, 2010 at 9:35 PM, Traveler <[email protected]> wrote: > package Adkins.GMTpackage; > > import android.app.Activity; > import android.os.Bundle; > import android.view.View; > import android.view.View.OnClickListener; > import android.widget.Button; > import android.widget.TextView; > import android.widget.EditText; > > > public class GMTactivity extends Activity implements OnClickListener { > TextView title; > TextView minsattitle; > TextView minustitle; > TextView minsatoutput; > TextView minusoutput; > TextView gmtinput; > Button gmtbutton; > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle icicle) { > super.onCreate(icicle); > setContentView(R.layout.main); > > title = (TextView)this.findViewById(R.id.title); > minsattitle = (TextView)this.findViewById(R.id.minsattitle); > minustitle = (TextView)this.findViewById(R.id.minustitle); > gmtinput = (TextView)this.findViewById(R.id.gmtinput); > gmtbutton = (Button)this.findViewById(R.id.gmtbutton); > gmtbutton.setOnClickListener(this); > } > > public void onClick(View v) { > calculateGmt(); > } > > @SuppressWarnings("null") > protected void calculateGmt() { > > double val = > Double.parseDouble(gmtinput.getText().toString()); > // in a real app, we'd get this off the 'net > minsatoutput.setText(Double.toString(val * 2)); > } > } > > -- > 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

