Could you look at the logcat output (Eclipse > Windows > Perspective > DDMS) or "adb logcat" from a shell? There should be a strack trace that will tell you exactly what crashed.
For example, are you sure that the findViewById does not return null? R/ On Sat, Apr 11, 2009 at 7:59 PM, evo <[email protected]> wrote: > > Hi, > I had try some simply code on android. but when run on emulator. the > 1st pages are fine, when click the button to second pages. it pop up > error "Sorry - The application Pages (process com.Pages) has stop > unexpectedly" > > here the code:[Pages.java] > > package com.Pages; > > import android.app.Activity; > import android.content.Intent; > import android.os.Bundle; > import android.view.View; > import android.view.View.OnClickListener; > import android.widget.Button; > > public class Pages extends Activity > { > �...@override > protected void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > // Watch for button clicks. > Button goButton = (Button)findViewById(R.id.go); > goButton.setOnClickListener(mGoListener); > } > > private OnClickListener mGoListener = new OnClickListener() > { > public void onClick(View v) > { > Intent intent = new Intent(); > intent.setClass(Pages.this, loli.class); > startActivity(intent); > } > }; > } > > an next pages code[loli.java]: > package com.Pages; > > import android.app.Activity; > import android.os.Bundle; > > > /** > * Example of removing yourself from the history stack after > forwarding to > * another activity. > */ > public class loli extends Activity > { > �...@override > protected void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > > setContentView(R.layout.loli); > } > } > > I did't find any error on the code, is there any mistake done by me? > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

