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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:34:32+00:00 2026-06-12T02:34:32+00:00

In some places we were giving like DatabaseUtil db=new DatabaseUtil(DailyPlanView.this); where DatabaseUtil is the

  • 0

In some places we were giving like “DatabaseUtil db=new DatabaseUtil(DailyPlanView.this);” where DatabaseUtil is the class with the constructor argument is context. But if we create the object for the DatabaseUtil class in the DailyPlanVIew class we are using the above code. My doubt is what is the use of the context and instead of passing the context object as argument why we are passing “this”.

  • 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-12T02:34:33+00:00Added an answer on June 12, 2026 at 2:34 am

    Whenever you are dealing with Context, its important to understand its used in everything. From using a database to obtaining system services. This is required by the way android works with Context. Specifically when you are passing this you are basically passing the class that encapsulates this statement.

    class MyActivity extends Activity
    {
    
         onCreate(Bundle bundle)
         {
            View v = new View(this);
         }
    }
    

    passing this refers to the object that encapsulates it. This is a Object oriented concept… Where this is reffering to MyActivity. One thing to keep in mind when passing context is ensure that you are passing the correct kind. Some Context objects have a longer lifespan than others and if not managed properly can lead to Context leaking. Specifically in this example, this works because Activity extends Context.

    The differences occur in the View class.

    getApplicationContext()

    getBaseContext()

    this, which in the Context of an activity has the life span of an Activity (Example above)

    One thing to add about Context is that it is basically a reference to the current Application and it’s specific data.

    Some more information about context can be found in this thread:
    What is 'Context' on Android?

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

Sidebar

Related Questions

I hate giving out my code like this but I'm getting some errors about
I'm working on a class-based php web app. I have some places where objects
As seen here and some other places for each is well explained, but how
I'm testing some legacy code that extends the default php exception object. This code
Some outside code is giving me a string value like.. null,402,2912,2909,2910,2913,2911,2914,2915,2388,2389,2390, now i have
This is probably a really easy question to answer, but for some reason I'm
I've been doing some upgrades to a friends website. But now it looks like
So I have been working on this for some time. Would like to know
I need some info on this subject. I've searched around a bit but it
Some places in my flex app, I use ResourceManager.getInstance().getString, and other places I use

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.