Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getTargetContext() #352 Replace Context Deprecated #373

Merged
merged 2 commits into from
Oct 7, 2020

Conversation

DavidMarinov
Copy link
Contributor

@DavidMarinov DavidMarinov commented Oct 1, 2020

  • Using ApplicationProvider.getApplicationContext() instead of getTargetContext()

Replacing getTargetContext() with ApplicationProvider.getApplicationContext() as stated in the deprecated info.

/**
   * Return a Context for the target application being instrumented. Use this to get a {@link
   * Context} representing {@link Instrumentation#getTargetContext()} into your test.
   *
   * @deprecated use {@link androidx.test.core.app.ApplicationProvider#getApplicationContext()}
   *     instead.
   */
  @Deprecated
  public static Context getTargetContext() {
    return getInstrumentation().getTargetContext();
  }

Copy link
Member

@alorma alorma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@rocboronat
Copy link
Member

Cool! Thanks for the PR 🤗

@alorma alorma merged commit 87cd5a7 into AdevintaSpain:master Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants