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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:55:05+00:00 2026-06-15T04:55:05+00:00

I want to call method in some other class which need Context as input

  • 0

I want to call method in some other class which need Context as input parameter but i have 3 possibility in service:

- getApplicationContext
- getBaseContext
- getApplication

Which one to use in ScreenService which extends Service

what is the main different. I read some times ago that is not good to use getApplicationContext. Is that true?

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

    Application context is attached to the application’s life-cycle and will always be same throughout the life of application. So if you are using Toast, you can use application context or even activity context (both) because a toast can be raised from anywhere with in your application and is not attached to a window.

    Activity context is attached to the Activity’s life-cycle and can be destroyed if the activity’s onDestroy is raised.

    getApplication() though its referring to Application object but the Application class extends Context class, so it can be used to offer application context.

    getApplicationContext() offers application context.

    getBaseContext() offers activity context.

    It depends why you for which purpose you are using the context,

    getApplicationContext() is most preferred way since this Context lives untill Application shuts down.

    getBaseContext() Context is available to widgets and Views.

    so in a toast message or when creating an intent, they all have the same effect eventhough using getApplicationContext() is the most correct. Toast accepts any kind of Context since its not attached any kind of View. Its a notification.

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

Sidebar

Related Questions

In some class method, A, I need to call a library method B, which
I have a class which does operations on the database, but I want to
I'm using CoreLocation,and I want to call a method to do some computations on
I have a requirement: I want to call method every day at any particular
I want to call a method of my class inside a lambda expression: void
I want to call a method, pass it the length and have it generate
I Have an application in my account and I want to call a method
I want to call a validation method inside a shared gwt class that i
I want to call a method say success(message) of javascript from android activity. I
i want to call a method that placed in tag in master page like

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.