Re: How does the Android know that "It has to focus a Preference"

586 views
Skip to first unread message

Dianne Hackborn

unread,
Jul 22, 2010, 2:01:06 AM7/22/10
to android-...@googlegroups.com
View focus is maintained per window, so if a window loses focus, the next time it gains focus back the same view inside of it will still have focus.  This is generally a feature.

If you are talking about just highlighting (not focus) it just may be a back in the code to not clear the highlight state at some point when the window is no longer interacting with the user...  though generally once you start touching on a window, touch events will continue to be delivered to it until the final up occurs, even if another window appears on top of it, just to ensure it gets a consistent event stream.

On Wed, Jul 21, 2010 at 7:58 PM, Praneeth <pranee...@gmail.com> wrote:
When we touch a Preference, how does the android know that It needs to
focus the Preference.

I have a Preference as an element in Preference Screen in a
PreferenceActivity.

I handle events on the Preference using onPreferenceTreeClick.

I have a situation, where I keep my finger on Preference and I dont
remove the finger. (Similar to LongClick....u can consider it as
LongPress rather).

When the Preference is still highlighted, My current activity goes
into "onPause" because one of the sensor has become active.
After it has finished onPause, I removed my finger from Preference
leaving the event unhandled.

When the Activity resumes back from its onPause state, I find that the
Preference is still highlighted.---this is the problem

From the logs I could make out that the event was lost after onPause
was called.
"07-15 20:06:44.616: WARN/WindowManager(1274): No window to dispatch
pointer action 1"

Please drop down your suggestion.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Dianne Hackborn

unread,
Jul 22, 2010, 12:35:53 PM7/22/10
to android-...@googlegroups.com
It has nothing to do with the log message.  Focus remains wherever it was last set.

On Thu, Jul 22, 2010 at 4:14 AM, Praneeth <pranee...@gmail.com> wrote:
Thanks Dianne Hackborn for your reply.

My issue is about "Focus". The Preference remained focused after the
sensor got turned OFF from the ON state.

But I suspect that the event was missing because the log mentions the
below statement.

WARN/WindowManager(1274): No window to dispatch pointer action 1"

Incase I am wrong, please correct.

> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-platform?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer

>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.

Praneeth

unread,
Jul 21, 2010, 10:58:36 PM7/21/10
to android-platform

Praneeth

unread,
Jul 22, 2010, 7:14:38 AM7/22/10
to android-platform
Thanks Dianne Hackborn for your reply.

My issue is about "Focus". The Preference remained focused after the
sensor got turned OFF from the ON state.

But I suspect that the event was missing because the log mentions the
below statement.
WARN/WindowManager(1274): No window to dispatch pointer action 1"

Incase I am wrong, please correct.

On Jul 22, 3:01 pm, Dianne Hackborn <hack...@android.com> wrote:
> > android-platfo...@googlegroups.com<android-platform%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-platform?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com

Antriksh

unread,
Feb 8, 2016, 10:09:53 AM2/8/16
to android-platform
Hi Praneeth,

I encounter the same problem, in which touch feedback remains.

Solution:
As Dianne explained "window loses focus, the next time it gains focus back the same view inside of it will still have focus".
Just add 300 ms delay (use handler) inside onPreferenceClick method, which let preference screen to finish-off the touch feedback and then launch your activity or fragment or widget..etc

I hope this can help someone who encounter the same problem.

Regards,
Antriksh



Reply all
Reply to author
Forward
0 new messages