title: Variable database name for ContentProvider
body: <p>I am creating a custom ContentProvider in Android, all the examples I find show the database name being hardcoded, instantiated like this:</p>
  
  <pre><code>public class ItemProvider extends ContentProvider {
  
      private static String DATABASE_NAME = "xyz";
  
      public static class ItemDatabaseHelper extends SQLiteOpenHelper {
  
      ItemDatabaseHelper(Context context) {
          super(context, DATABASE_NAME, null, DATABASE_VERSION);
  
      }
  </code></pre>
  
  <p>What I want to do is use a variable for the database name at runtime, I dont want to hard code the database name in the class. I have tried to find examples of doing this using the ContentProvider class, and have looked through the documentation as well. I can do this if I shed the ContentProvider class and just use a SQLiteOpenHelper class because I can pass in the database name to the constructor as a parameter but I cannot figure out if its possible for ContentProvider. Here is how I get a variable name for the database using SQLiteOpenHelper:</p>
  
  <pre><code>public static class ItemDatabaseHelper extends SQLiteOpenHelper {
  
      ItemDatabaseHelper(Context context, String dbname) {
          super(context, dbname, null, DATABASE_VERSION);
      }
  </code></pre>
  
  <p>Can anyone help me get a variable database name for a Content Provider?</p>
  
  <p>Thanks.</p>