Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Changing layout depending on the current layout in Java
New Posts  All Forums:Forum Nav:

Changing layout depending on the current layout in Java

post #1 of 2
Thread Starter 
I'm looking to switch from one layout to another depending on the current view showing with a button.

public void onClick(View v) {
if(WHAT GOES HERE == (R.layout.dads_main));
setContentView(R.layout.activity_main);

Help would be appreciated,

white
post #2 of 2
Looks like an android app to me.

The easiest solution for you is probably to use ViewFlipper.
ViewFlipper has many awesome features. But what's most important to you, is that it can contain multiple layouts, and you can cycle between them simply by calling the next() or previous() methods. No need to do any if statements or unnecessary logic. It does what you need out of the box.

Here's a good tutorial on how to use ViewFlipper.
Death Star
(21 items)
 
Darksaber
(11 items)
 
 
CPUMotherboardGraphicsRAM
Athlon II x2 245 Asus M3A78 Radeon HD6570 1GB Mushkin Silverline 2GB DDR2  
Hard DriveOptical DriveOSMonitor
OCZ Vertex 2 120GB Samsung Blu-Ray Windows 7 Samsung 46" DLP 
PowerCaseOther
Silverstone Strider Essentials 400W Silverstone Milo ML03B Hauppage WinTV 1250 
  hide details  
Reply
Death Star
(21 items)
 
Darksaber
(11 items)
 
 
CPUMotherboardGraphicsRAM
Athlon II x2 245 Asus M3A78 Radeon HD6570 1GB Mushkin Silverline 2GB DDR2  
Hard DriveOptical DriveOSMonitor
OCZ Vertex 2 120GB Samsung Blu-Ray Windows 7 Samsung 46" DLP 
PowerCaseOther
Silverstone Strider Essentials 400W Silverstone Milo ML03B Hauppage WinTV 1250 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Changing layout depending on the current layout in Java