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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:32:14+00:00 2026-05-30T18:32:14+00:00

I have a question : So i have this line of code(i got it

  • 0

I have a question :
So i have this line of code(i got it from tuts in thenewboston) :

SharedPreferences getPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

My question is : what did we do in this line? i think we create an object from SharedPreferences, but what about the PreferenceManager Class?is it the super Class of SharedPreference?is it has some relation with OOP?

Thanks all ~

PS : English is not my native languange, so sorry if i made some mistake’s 😀

  • 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-05-30T18:32:15+00:00Added an answer on May 30, 2026 at 6:32 pm

    The PreferenceManager has a static method named getDefaultSharedPreferences. What this means is that you can call the method without first constructing an instance of ‘PreferenceManager’. Static methods do not operate on instance variables within a class.

    Static methods can create instances of objects, and return them. In this case, the static method created a new SharedPreferences object that you’re storing in a local variable.

    Think of it like this: A static method exists once for all the instances of an object. Every time you call that static method, it’s doing the same thing regardless of what each object might know. Based on the context passed into it, it will create a SharedPreferences object that you can use.

    I hope this helps!

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

Sidebar

Related Questions

I have this question: How could I call a codebehind method from jquery? I
I have a question concerning this code which I want to run on QNX:
I've got a speed question. I have a bash script which parses information from
I have this question: Does implementing a custom MembershipProvider class needs you to implement
I have this question in which I have a SQL Server Compact Edition database
I have this question because I am not familiar latest generation of MS VS
I have this question relating to Lucene. I have a form and I get
I have a question about this question . I posted a reply there but
I have few question in this regard When you create an internet page, does
Again I have a question regarding this plugin: http://t.wits.sg/2008/06/20/jquery-progress-bar-11/ What I want to achieve

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.