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

  • Home
  • SEARCH
  • 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 8610809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:12:54+00:00 2026-06-12T04:12:54+00:00

I am using the preferenceActivy class to manage my preferences. But I need to

  • 0

I am using the preferenceActivy class to manage my preferences. But I need to close the whole preferences from a fragment. Source code is cut to a minimal example

public class VPNPreferences extends PreferenceActivity {
   public boolean onOptionsItemSelected(MenuItem item) {
       finish(); // This should close fragment + Preferences list
   }

   public boolean onCreateOptionsMenu(Menu menu) {
       getMenuInflater().inflate(R.menu.vpnpreferences_menu, menu);
      return super.onCreateOptionsMenu(menu);
   }

}

I use the new 3.2+ API which display as two column on tables and as sperate Activities on mobile phone. The menu icon is visible on both the list and the Activity with the fragment.

When the button button is pressed the activy should close and if the activity is the fragment was called from the Settings list that setting list should close too. Unfortunately finish() only closes the current fragment Activity.

  • 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-12T04:12:55+00:00Added an answer on June 12, 2026 at 4:12 am

    What I do is registered a BroadcastReceiver in each of my preference activites, and all it does is call finish(). When I want to close the settings, I send a broadcast with that action.

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

Sidebar

Related Questions

I'm using common code in my Activity like this: abstract class CommonCode extends Activity
I had been using shared preferences to store some user values.... but when the
Using PreferenceActivity, Android automatically saves simple preferences such as checkboxes being checked etc. I
Using a populated Table Type as the source for a TSQL-Merge. I want to
I have a custom class that extends Preference that I'm using in conjunction with
in my application I call startActivityForResult( new Intent(this, ShowPreferencesActivity.class), <some code>); the activity is
Using mercurial, I've run into an odd problem where a line from one committer
I need to check the user input in the preferences if they want to
I'm using PreferenceActivity to set some preferences about another BroadcastReciever that i have. While
import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.preference.PreferenceActivity; public class Preferences extends

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.