tinyang wrote:
> Well my problem now is that I am trying to start the SubActivity on the
> button click, but when I run it in the emulator, it does not Launch the
> SubActivity, and I can't figure out why.  Here is all of my code:
> 
> public class MainMenu extends Activity {
>     /** Called when the activity is first created. */
>       Button guidebtn = null;
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main); //xml file that has the layout needed
>         guidebtn = (Button) findViewById(R.id.guide); //find the button from
> the xml layout
>       }
>       public class guide extends Activity {
>               public Button onClick(View guide){
>                       startActivity(new Intent(this, SubActivity.class));
>                       return guidebtn;
>               };
>       }
> }
> 
> What am I missing?                     

I think you need to spend some more time with some tutorials, such as:

http://developer.android.com/guide/tutorials/notepad/index.html

1. You have not connected a View.OnClickListener to your Button

2. Your guide class is unused, and probably should not be there, with
your onClick() implementation being moved to the View.OnClickListener
you have not set up

The Notepad tutorial, linked to above, will demonstrate how to use a Button.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Need help for your Android OSS project? http://wiki.andmob.org/hado

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

Reply via email to