title: How to use Firebase Analytics in some other class which is not an Activity class in Android?
body: <p>We know that, we can log event in an activity using the code:</p>
  <pre><code>FirebaseAnalytics.getInstance(this).logEvent(&quot;hello&quot;, new Bundle());
  </code></pre>
  <p>Suppose I have this class &quot;Student&quot;, which is a simple class called inside different activities. All I want to know is how to use FirebaseAnalytics inside this &quot;Student&quot; class without passing the context or getApplicationContext() or &quot;this&quot; keyword?</p>
  <p>N.B: FirebaseCrashlytics can be used in &quot;Student&quot; class as follow:</p>
  <pre><code>FirebaseCrashlytics.getInstance().log(&quot;logstudentclass&quot;);
  </code></pre>
  <p>Also &quot;Student&quot; class be like:</p>
  <pre><code>public class Student{
       private String name;
       private String roll;
        
       public Student(String name, String, roll){
           this.name=name;
           this.roll=roll;
       }
       // bla bla bla methods
       // bla bla bla getters setters
  }
  </code></pre>