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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:29:41+00:00 2026-05-29T13:29:41+00:00

To start an Activity you need an Intent, like: Intent i = new Intent(context,

  • 0

To start an Activity you need an Intent, like:

Intent i = new Intent(context, class)

So to fill in the context parameter, a couple of options are available:

  • Use MyActivity.this or just this
  • Use getApplicationContext()
  • Use getBaseContext()

And I’m sure there are one or two more options.
These options all appear in some sort of tutorial, one uses the first, the next uses the third option.

So which one should I use? Does it even matter? Is it different for different cases?

  • 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-29T13:29:41+00:00Added an answer on May 29, 2026 at 1:29 pm

    Yes its different for different cases,

    It depends on the scope. Suppose if you are creating a method in a global class that extends Application to create a Toast that is used in every class of your Application you can use getApplicationContext() to create it.

    If you want to create a view that is restricted to that particular Activity you can use Activity.this

    Also if you want to create an AlertDialog in some inner class say AsyncTask, then you have to use Activity.this, because the AlertDialog is to be linked to Activity itself.

    Also don’t use getBaseContext() just use the Context that you are having. For getting further information for the same you can see this Answer.

    So, the answer to the real question is better to use Activity.this to start a new Activity.

    Intent intent = new Intent(Current_Activity.this, Calling.class);
    startActivity(intent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In an given Android activity, I would like to start a new activity for
Does switching activities in Android start a fresh JVM? It seems like each activity
I need to change Activity to ListActivity. But I can't start my project... do
When you are about to start a new activity, and want to pass a
I want to start multiple instance of the same Activity class from a Service
I need simple start an application from my code, like Skype, or other one.
I have button and onClick I perform opening of a new activity like this:
I have two classes which extend Activity and need to call another class method
I have an activity with two buttons, start and stop. If the user press
I have the following problem: I have an Activity where a user can start

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.