Re: [android-developers] How to check the current contentView?

2012-05-16 Thread Dianne Hackborn
Honestly don't try to be clever, just have your own variable that keeps track of the last kind of content view you set. Be careful about ViewFlipper, since I believe it means that all of the view hierarchies will stay instantiated all of the time. And ultimately, this is the kind of thing that

Re: [android-developers] How to check the current contentView?

2012-05-16 Thread Narendra Singh Rathore
Honestly don't try to be clever. That wasn't cleverness, but the curiosity. just have your own variable that keeps track of the last kind of content view you set. Ok, How? Do you mean, doing like *View v=findViewById(R.layout.main)*; or something else? Be careful about ViewFlipper,

Re: [android-developers] How to check the current contentView?

2012-05-16 Thread Kostya Vasilyev
I think Dianne meant something like: class MyActivity { enum ViewMode { MAIN, DETAILS, INFO, ABOUT }; private ViewMode mViewMode; somewhere in the activity's code: setContentView(R.layout.main); mViewMode = ViewMode.MAIN; ...

Re: [android-developers] How to check the current contentView?

2012-05-16 Thread Narendra Singh Rathore
class MyActivity { enum ViewMode { MAIN, DETAILS, INFO, ABOUT }; private ViewMode mViewMode; somewhere in the activity's code: setContentView(R.layout.main); mViewMode = ViewMode.MAIN; ...

Re: [android-developers] How to check the current contentView?

2012-05-15 Thread Justin Anderson
This is not the typical Android workflow, so I highly recommend you don't do this... But, if you are dead set on this kind of behavior, do the following: 1. Put all your main views you want in either a ViewFlipper (or ViewSwitcher if there are only 2) 2. After calling setContentView,

Re: [android-developers] How to check the current contentView?

2012-05-15 Thread Justin Anderson
That way you also only have to call setContentView() one time... I'm not even sure if calling that multiple times like you are doing is allowed. Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Tue, May 15, 2012 at 2:32 PM, Justin Anderson

Re: [android-developers] How to check the current contentView?

2012-05-15 Thread Brian Collo Gonçalves
Maybe using a static var to maintain the view you're using and get the value in any other point you need to validate it. 2012/5/15 Justin Anderson magouyaw...@gmail.com This is not the typical Android workflow, so I highly recommend you don't do this... But, if you are dead set on this kind

Re: [android-developers] How to check the current contentView?

2012-05-15 Thread Narendra Singh Rathore
On Wed, May 16, 2012 at 2:05 AM, Justin Anderson magouyaw...@gmail.comwrote: I'm not even sure if calling that multiple times like you are doing is allowed. Well, I am pretty sure about using that multiple times, as it is working well in that case. Only, you have to keep in mind that we must

Re: [android-developers] How to check the current contentView?

2012-05-15 Thread Justin Anderson
Still... the ViewSwitcher/ViewFlipper approach is a better one. Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Tue, May 15, 2012 at 10:51 PM, Narendra Singh Rathore nsr.curi...@gmail.com wrote: On Wed, May 16, 2012 at 2:05 AM, Justin Anderson

Re: [android-developers] How to check the current contentView?

2012-05-15 Thread Narendra Singh Rathore
On Wed, May 16, 2012 at 10:29 AM, Justin Anderson magouyaw...@gmail.comwrote: Still... the ViewSwitcher/ViewFlipper approach is a better one. Ok, thanks. I know using ViewFlipper, and will use that surely. But just wanted to achieve my goal in a different way. Thanks again for valuable