click on a gone view

by Guian » Thu, 04 Jun 2009 00:01:40 GMT


Sponsored Links
 Why is this possible ?


code :
        private OnClickListener _Listener = new OnClickListener()
        {
            public  void onClick(View v)
            {
                  if(v== myView){
                        if(myView.getVisibility()==View.GONE)
                              Log.d("onClick","Why is this
possible ?");
                  }
                }
           }
...
View myView = new View(this);
...
myView.setOnclickListener(_Listener);

I use View.VISIBLE / GONE to exchange display of two views... and when
I want to click on the visible one, the gone one is catching it...

is that normal ?
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Multiple Tasks within an Application & Stack Overflow

It is understandable that if you have Activities (in the same task)
that can reference each other through startActivity(), that you could
have a circular loop where the user keeps going back/forth between the
Activities, and your Activity stack would keep growing without bound
until it finally ends in Stack Overflow.

Now, what happens if you want your app to consist of two (or more)
separate Tasks, where each Task has it's own Activity stack.  Buttons
(or menus) in the app would allow the user to switch Tasks bring bring
the requested Task to the foregound using Intents with flags
FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_RESET_TASK_IF_NEEDED (similar
to what the Launcher does when it brings a Task to the front).  Since
each Task has it's own Activity back-stack, there wouldn't be a Stack
Overflow within a Task.  However, what I've noticed when I tried
implementing this is that as you switch Tasks, there seems to be a
"Task Back Stack" within Android, such that if you switch between Task
A, then B, then back to A, (and so on), when you hit the 'back'
button, the system goes back through the history of your Task
switches.  Even though new Activities are not being added to the Task
stack(s), there does seem to be an additional history that contains
the active Tasks.  So it seems as if you could get a different kind of
"Overflow", but with Task switch history, not Activity history.  Can
anyone confirm or deny this?

I would really like my app to have separate Tasks within it.  There
will be a main Task that is associated with the LAUNCHER, and a set of
Activities for viewing data in that stack.  Then, I'd like the user to
be able to switch to different "tabs" in the application where each
Tab has it's own Task and Activity back stack (i.e. the main Task
views financial markets, another Task allows the user to view their
market orders, and drill down into details, a third Task allows the
user to view their market positions, and drill down into details,
etc).  I KNOW I can use TabHost and ActivityGroup, but believe me,
I've tried these approaches and I have had a myriad of problems with
them.  I don't really want to switch views within the Tabs either, I'd
rather have separate Activities so that I can reuse them in other
places, and also because I rely on the Activity lifecycle to subscribe/
unsubscribe to market data and other items.

So in conclusion, my first question revolves around whether I need to
worry about Task switching history overflow, and my other question
revolves around finding the best way to implement this type of
navigation within my app, without resorting to separate LAUNCHER apps
for each Task (I'd like to package up one Application and one LAUNCHER
icon).

-- 

2. SearchView as part of the AlertDialog

Hi All,

I am trying to place the search widget [SearchView basically] in the
title part of an AlertDialog. Is that allowed i.e will it work? The
idea is to have the user enter a search word and when he/she presses
the "Enter" key on the keyboard, to use the search word entered to
search through an array of strings and display the result as a
listView in the same AlertDialog's body portion. The following is the
piece of relevant code.

AlertDialog.Builder dialogBuilder = new
AlertDialog.Builder(MainActivity.this);

RelativeLayout titleLayout = new RelativeLayout(this);
SearchView sv = new SearchView(this);
titleLayout.addView(sv);

dialogBuilder.setCustomTitle(titleLayout);

When i run this code, i see the search widget in the title alright.
The Virtual/Soft keyboard pops up when i click inside the search box -
but i am unable to type in it because the AlertDialog disappears as
soon as i click anywhere outside of it (as it should). I am wondering
if the keyboard is associated with the activity that is launching the
alertdialog instead of being in the context of the AlertDialog itself.

Any ideas?

TIA.

-- 

3. Imageview doesn't increase size inside ScrollView

4. How to obtain dimensions of an Activity's top-level view.

5. Textview background with text inside background image

6. writeNativeHandle - why call dup( )

7. (WTS) Xoom, Samsung tab Sprint