2 messages in com.googlegroups.android-beginners[android-beginners] Re: Switching Of ...| From | Sent On | Attachments |
|---|---|---|
| Rachna | 25 Jun 2008 01:08 | |
| Mark Murphy | 25 Jun 2008 12:41 |
| Subject: | [android-beginners] Re: Switching Of Screens![]() |
|---|---|
| From: | Mark Murphy (mmur...@commonsware.com) |
| Date: | 06/25/2008 12:41:42 PM |
| List: | com.googlegroups.android-beginners |
But now i want to change my code... I want that there should be only one class that extends Activity(say main_activity). And then i want the two classes TermsScreen.java and LoginScreen.java should get reference of that main_activity class.
I wrote code for all this and again made use of INTENT for switching but its not working. Can anyone please tell me will INTENT work or should i use something else to go from TermsScreen.java to LoginScreen.java
Intents are for switching between activities (among other uses), not for changing the UI of a single activity.
You can try calling setContentView() to the new UI when it is time to switch, but I am not certain that will work.
What will work is to use ViewFlipper or another concrete ViewGroup subclass. These work like tabbed windows (i.e., multiple discrete "screens"), just without the actual tabs -- you are responsible for switching between them as needed. It will require some reworking of your code, such as perhaps combining the two layout XML files into one.
The Animation2.java sample in the ApiDemos with the SDK uses ViewFlipper.
-- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ -- Available Now!
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to andr...@googlegroups.com To unsubscribe from this group, send email to andr...@googlegroups.com Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---




