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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:42:51+00:00 2026-06-09T21:42:51+00:00

Possible Duplicate: What is Context in Android? i read context in android current state

  • 0

Possible Duplicate:
What is Context in Android?

i read context in android current state of the application/object

   Intent intent=new Intent(this,SecondaryActivity.class);
   startActivity(intent);

in the place of this we can use getApplicationContext()
but in an

@Override
public void onClick(View view) {

Toast.makeText(getApplicationContext(), "Hai",Toast.LENGTH_LONG).show();
}

we can’t use this here i mean in getApplicationContext() why this also refers to the current object ,hence am confused about this and context help me to study this,an reference share me..

  • 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-09T21:42:52+00:00Added an answer on June 9, 2026 at 9:42 pm

    When you pass this to method, you mean that this reference is an instance of Context, so if you are in Activity you can pass this instead of Context. But when you are in anonymous class:

    button.setOnClickListener(new OnClickListener(){
         @Override
         public void onClick(){
             //here this is a reference to OnClickListener instance
         }
    

    To pass Context in onClick method you can write

    MyActivity.this
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Intent to launch the clock application on android I have a widget
Possible Duplicate: Difference between OnClick() event and OnClickListener? I'm semi-new to Android development and
Possible Duplicate: Difference between Activity Context and Application Context I want to know the
Possible Duplicate: BeanFactory vs ApplicationContext Simple word meaning of Application context and bean factory
Possible Duplicate: Android: how to cancel a request of Location update with intent? I
Possible Duplicate: Android NoSuchAlgorithmException: SSLContext SSL implementation not found Has anybody experience with this
Possible Duplicate: Android How to draw a smooth line following your finger I'm new
Possible Duplicate: Android - detect whether there is an Internet connection available this is
Possible Duplicate: Nested function parameters and 'this' context in Javascript I'm currently having problems
Possible Duplicate: Android ListView, start new activity Hey can someone tell me how I

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.