title: How to play music in background for all activities?
body: <p>I know people made posts about this but I am still confused on how to apply It for my app. here is my code Hopefully you guys can solve this</p>
  
  <p>MainActivity Code:</p>
  
  <pre><code>package an.lynxstore;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.design.widget.NavigationView;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarDrawerToggle;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.net.Uri;
  
  import an.lynxstore.a.ATE;
  import an.lynxstore.base.BaseThemedActivity;
  import an.lynxstore.dialogs.AboutDialog;
  
  public class MainActivity extends BaseThemedActivity implements NavigationView.OnNavigationItemSelectedListener {
  
  Intent myIntent = new Intent(MainActivity.this, LynxMusic.class);
  startActivity(myIntent);
  
  private DrawerLayout mDrawer;
  
  @SuppressWarnings("ConstantConditions")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
  
      if (!ATE.config(this, "light_theme").isConfigured(4)) {
          ATE.config(this, "light_theme")
                  .activityTheme(R.style.AppTheme)
                  .primaryColorRes(R.color.colorPrimaryLightDefault)
                  .accentColorRes(R.color.colorAccentLightDefault)
                  .coloredNavigationBar(false)
                  .navigationViewSelectedIconRes(R.color.colorAccentLightDefault)
                  .navigationViewSelectedTextRes(R.color.colorAccentLightDefault)
                  .commit();
      }
      if (!ATE.config(this, "dark_theme").isConfigured(4)) {
          ATE.config(this, "dark_theme")
                  .activityTheme(R.style.AppThemeDark)
                  .primaryColorRes(R.color.colorPrimaryDarkDefault)
                  .accentColorRes(R.color.colorAccentDarkDefault)
                  .coloredNavigationBar(true)
                  .navigationViewSelectedIconRes(R.color.colorAccentDarkDefault)
                  .navigationViewSelectedTextRes(R.color.colorAccentDarkDefault)
                  .commit();
      }
  
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      final Toolbar toolbar = (Toolbar) findViewById(R.id.appbar_toolbar);
      setSupportActionBar(toolbar);
      toolbar.setTitle(R.string.app_name);
      toolbar.setNavigationIcon(R.drawable.ic_menu);
  
      mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
      mDrawer.setDrawerListener(new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.drawer_open, R.string.drawer_close));
  
      final NavigationView navView = (NavigationView) findViewById(R.id.navigation_view);
      navView.setNavigationItemSelectedListener(this);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.main, menu);
  
  
      return super.onCreateOptionsMenu(menu);
  }
  
  
  
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
      mDrawer.closeDrawers();
      final int mItemId = item.getItemId();
      mDrawer.postDelayed(new Runnable() {
          @Override
          public void run() {
              switch (mItemId) {
                  case R.id.drawer_settings:
                      startActivity(new Intent(MainActivity.this, SettingsActivity.class));
                      break;
                  case R.id.drawer_about:
                      AboutDialog.show(MainActivity.this);
                      break;
              }
          }
      }, 75);
      return true;
  }
  </code></pre>
  
  <p>LynxMusic Code:</p>
  
  <pre><code>package an.lynxstore;
  
  import android.media.MediaPlayer;
  import android.os.AsyncTask;
  
  public class LynxMusic extends AsyncTask&lt;Void, Void, Void&gt; {
  
  @Override
  protected Void doInBackground(Void... params) {
      MediaPlayer player = MediaPlayer.create(myIntent.this, R.raw.lynx);
      player.setLooping(true); // Set looping
      player.setVolume(100,100);
      player.start();
  
      return null;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Once again thank you for the help! I'm new to this.</p>