Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9271665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:40:35+00:00 2026-06-18T15:40:35+00:00

It is expected that onUserInteraction is being called for any user interaction. it works

  • 0

It is expected that onUserInteraction is being called for any user interaction. it works fine in PreferenceActivity. However, when a DialogPreference is popup, onUserInteraction is not called anymore even there is user interaction such as touch event.

It seems that DialogPreference is not the only case. Whenever Dialog is shown, it does not report the user interaction to activity.

But what can I do if I really need it. Thank You.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:40:37+00:00Added an answer on June 18, 2026 at 3:40 pm

    As far as I know, the onUserInteraction() is simply not called while the user is interacting with a dialog (even started from Activity in which you’re monitoring interactions).

    Two solutions I know are:

    • Subclass Dialog/DialogPreference class and override dispatchTouchEvent().

    • Implement Window.Callback interface and set it as Dialogs window callback by issuing:

      dialog.getWindow().setCallback(callbackImplementation);
      

      Note: this implementation should process all received events by calling appropriate dialog methods or handle the events in your own way (e.g. by manually calling onUserInteraction()).

    Edit

    You have couple of ways to get Activity from the custom PreferenceDialog instance.

    1. Call DialogPreference.getPreferenceManager() method which returns PreferenceManager. It has a getActivity() method but it’s package-private so you would have to put your custom DialogPreference in android.preference package to access it.

    2. In the PreferenceActivity.onCreate(), after inflating the preferences, use findPreference() to find your custom DialogPreference by key. Then cast it to your custom class and set activity to this via an accessor.

    I would go with the second option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple HTML5 game that works as expected from a regular
I expected that the padding inside a div would remain clear of any text.
Is it expected that the Facebook Registration widget not work on mobile browsers? Specifically
Why $val is Array(1), but not the numeric value? I expected that $selected as
I expected that manualy scheduled tasks will not change their dates automatically despite of
Is it expected that C-M-% and ESC C-% do not run the command query-replace-regexp
I have a Rails app implementing a game, so it's expected that a player
Is it expected behavior that two encodings can map to the same decoding? I'm
Getting red warning message that expected identifier for this statement CALayer = ImageView.layer; Using
I have a program that's expected to take as input a few options to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.