wood burning stoves 2.0*
The moose likes Android and the fly likes button to new activity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "button to new activity" Watch "button to new activity" New topic

button to new activity

Amir Rahav

Joined: Jul 28, 2012
Posts: 2
i have my main activity, wich has fe buttons, one of them - COLOR, will open a new list view activity with a list of colors.
so i have both of the xml, and both of the java pages. i put in the main acticity a listener for that button and made a new intent and gave the start activity command. but when i run it on the emulator it crashes when ipress COLOR button.

this is in my main activity:

what am i doing wrong?
Amir Rahav

Joined: Jul 28, 2012
Posts: 2
and that is the second activity - the color selec page:

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37884
Welcome to the Ranch

Please indent your code correctly, and don’t double‑space it. I shall try to edit your code and you can see how much better it looks.
We can only help you if you give us more details. When does your application crash? Do you get a stack trace or error message? What does it say? Copy the exact text.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37884
Is .show() really supposed to be on a line by itself? Is it the Component#show() method? You realise that has been deprecated?
Darryl Burke

Joined: May 03, 2008
Posts: 4523

That's Android code, not Swing. Moving the thread.

luck, db
There are no new questions, but there may be new answers.
Nick Johnson

Joined: Jun 21, 2012
Posts: 16
Please elaborate more, so that we can understand the problem easily.......
Naishadh Parmar
Ranch Hand

Joined: Jun 02, 2011
Posts: 95

Have you written about the second activity in the manifest file.
Many people don't write in the manifest file, and when the activity does not start they scratch their head.

You have to write under the <application> tag
It is sorta covered in the JavaRanch Style Guide.
subject: button to new activity
Similar Threads
Screen changing
ActivityNotFoundException while using implicit intent
Fetching contacts from phone book
Why error in this code
[Resolved] Application crashes on starting second Activity