Any benefit to starting an Activity via an intent one way versus another?

Viewed 125

I know of two ways to start an Activity with an intent. Let's say I'm in Activity A and I want to start Activity B. I could do the following.

1) In Activity B I have some static method:

public static Intent newIntent(Context packageContext){
    Intent intent = new Intent(packageContext, ActivityB.class);
    return intent;
}

And from Activity A I can call:

startActivity(ActivityB.newIntent(this));

2) The other method is the one I see more often:

From Activity A I do the following

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

Are there any benefits or drawbacks to using one versus the other? I think method 1 is a bit cleaner because it keeps the intent information in the class that will actually be started with the intent.

2 Answers
Related