first of all remove this line TextView txtView = (TextView)this.findViewById(R.id.textview);
and place it in onCreate() method, after this line. setContentView(R.layout.main); On Tue, Jul 26, 2011 at 6:29 PM, Rikki <[email protected]> wrote: > I am receiving application stopped unexpectedly from the following > piece of code. Can someone help > > package pkg.navigate; > > import android.app.Activity; > import android.os.Bundle; > import android.os.CountDownTimer; > import android.widget.TextView; > > public class navigateActivity extends Activity { > /** Called when the activity is first created. */ > TextView txtView = (TextView)this.findViewById(R.id.textview); > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > new CountDownTimer(30000, 1000) { > public void onTick(long millisUntilFinished) { > txtView.setText("Waiting for "+ millisUntilFinished/1000 > + " seconds"); > } > public void onFinish() { > txtView.setText("Finished!!!"); > } > }.start(); > } > } > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" 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-developers?hl=en -- *Regards, Viral* -- You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en

