title: Best example of Abstract class in Android
body: <p>I am trying to design one Abstract class and method in Android and call those methods by extending the class from my parent Activity class but I don't how to call my abstract method.</p>
  <p>MyCode :</p>
  <p><strong>MainActivity.java</strong></p>
  <pre><code>public class MainActivity extends MyActivity {
  
      @Override
      public void onTest() {
  
         Log.d(&quot;MyLog&quot;, &quot;onTest&quot;);
  
      } }
  </code></pre>
  <p><strong>MyActivity.java</strong></p>
  <pre><code>public abstract class MyActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);
  
      }
  
  public abstract void onTest(); }
  </code></pre>
  <p>So this is the above code snippet , please let me know , how to use Abstract in Android because i have never done this before.</p>