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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:15:32+00:00 2026-06-02T10:15:32+00:00

Is there any functional difference between using the intent-filter Intent myIntent = new Intent(com.this.that.MYACT);

  • 0

Is there any functional difference between using the intent-filter

Intent myIntent = new Intent("com.this.that.MYACT");
myIntent.setPackage("com.this.that");

vs.

Intent myIntent = new Intent(context, MyActivity.class);
myIntent.setPackage("com.this.that");

Is one of these

  • safer?
  • faster?
  • some other advantage?

Or is there no difference at all?

TIA

  • 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-02T10:15:33+00:00Added an answer on June 2, 2026 at 10:15 am

    The answer is: use whatever Intent structure that the author of the “external app” told you to use, or use getLaunchIntentForPackage() on PackageManager to get an Intent suitable for generically starting up the “external app”.

    I’ve tested them both in both circumstances, and don’t see any difference in behavior.

    That is only because com.this.that.MyActivity happens to have an <intent-filter> or has specifically marked itself is as being exported. By default, activities are not exported, and no Intent can be used to launch them from a third-party app.

    Also, your code will not even compile, as MyActivity is not in your project (it is in the “external app”), and so MyActivity.class does not exist. The only way it will compile (and work successfully) is if both your app and the “external app” happen to have the same activity class in the same Java package, which is unlikely.

    safer?

    The author of the “external app” should be using Intent actions (your first scenario), as it is easier to keep those consistent in the face of refactoring code. Your second approach will break if the author of the “external app” refactors their code into sub-packages, renames the activity class, etc. Basically, the action name becomes the public API, if you will, of the activity (along with any documented extras). This is why you see the Android SDK use this approach exclusively for its own documented and supported activities.

    faster?

    There might be a tiny speed increase for the second one, but we’d be talking microseconds per startActivity(), which is not worth worrying about.

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

Sidebar

Related Questions

I was wondering if there are any difference between function __construct() { parent::__construct(); $this->load->
Is there any difference between using: $(document).ready(function(){ vs. $(function(){ Does one of these work
XAML : What is the functional difference between the following notations? Is there any
Is there any difference between using AcceptEx direct call or using function pointer obtained
Is there any difference between using vcl components in Delphi and WinApi functions to
Is there any difference between a variable declared as static outside any function between
Is there any difference between int on_exit(void (*function)(int , void *), void *arg); and
What is the main difference between of using this: document.addEventListener('mousedown', function() { // code
Is there any difference between pointer to const and usual pointer for functions? When
I was a little curious to know that what is the difference between using

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.