Go Back   Android Forums > Android Discussion > Android Applications
Android Applications All the information you could ever want about Android Applications. Learn about apps and get help with them... all here! New apps can be found and announced in the Applications Announcements forum linked below.

New Forums: Nexus 6 | Nexus Player | Nexus 9
test: Reply
LinkBack Thread Tools
Old September 19th, 2011, 05:16 PM   #1 (permalink)
Junior Member
Thread Author (OP)
Join Date: Mar 2011
Location: Mexico
Posts: 30
Device(s): Samsung Galaxy 5 (GT-I5500L), Samsung Galaxy Ace
Carrier: Not Provided

Thanks: 11
Thanked 2 Times in 2 Posts
Confused Change from one layout view to another and going back?

Hi!!! want to make an Android app that starts with a "main" layout and when you push a button (called stateboton) that is in this layout the layout changes to a "main2" layout containing another button (called boton2), and when you push this one you get back to the first main.

I want to do this in the same activity with out creating or starting another one.

Here I show you part of the code:
    public class NuevoshActivity extends Activity 
    implements SensorEventListener,  OnClickListener {
        private Button stateButton;
        private Button boton2;
    /** Called when the activity is first created. */ 
      public void onCreate(Bundle savedInstanceState) { 
    this.stateButton = (Button)this.findViewById(R.id.boton);
    this.boton2= (Button)this.findViewById(R.id.boton2);      
    public void onClick(View v) {
     if(v==stateButton) {
    else if(v==boton2) {
The mains only have some images, text views and the buttons.

But I've some troubles. Can't it just be as simple as that or what am I missing or what is wrong?

lugopaco is offline  
Reply With Quote
sponsored links
android, button, layout

Go Back   Android Forums > Android Discussion > Android Applications
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -5. The time now is 08:10 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.