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 8623479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:17:27+00:00 2026-06-12T07:17:27+00:00

I want my program to store credentials for a remote service, so the user

  • 0

I want my program to store credentials for a remote service, so the user would set them in preferences once and never do that again.

So I’ve subclassed a DialogPreference, and my class displays a nice dialog with two fields for login and password. Very good.

Now I want to validate the data when the user entered it and clicked OK, just to prevent the stupid situation when bad login is stored and we have to peek the user with warnings and ask him to go and enter the data again.

Here is the first problem: the default behaviour of the DialogPreference is closing when the button is clicked (I wonder why?)—of course I can override onDialogClosed() and validate the login there, but the dialog is closed no matter if I call super.onDialogClosed() or not.

OK, after a couple of hours searching and trying I’ve found an answer that looks great at the first glance: the click handler on the positive button allows what I want. But another problem comes: as the original click handler is replaced, the dialog doesn’t close anymore. Calling super.onDialogClosed() doesn’t help; I assume that this method is just a notification that doesn’t provide any control.

So how to close the DialogPreference programmatically with positive result? Since I replace the default click handler for my positive button, I guess I need to call the old handler myself, but how to do that?

  • 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-12T07:17:28+00:00Added an answer on June 12, 2026 at 7:17 am

    Did you tried calling dismiss() method of the Dialog class after you done with the validation?

    like : getDialog().dismiss()

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

Sidebar

Related Questions

I want a program that would help me create virtual devices on a virtual
I'd want to make a program that could save different values and store it
I want to write a program in C or C++ that asks to user
I want to render n texture in my program and store them for later
I've got a C++ program that uses SQLite. I want to store the SQL
I want to take some information from opencv program and then store them in
I want to make a program for a restaurant, to hold foods and store
I want a program that runs continually and monitors the time constantly. When it's
I want my program to change its window's caption in response to various user
I want to program a board game (similar to checkers) for the iPhone. Would

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.