title: Can't get Android ContentProvider to work
body: <p>I am trying to put together a simple app to help me understand the content provider but I can't get it to work. I want to insert data into a database but I think the problem I have is somewhere with the URI.</p>
  
  <p>** I am trying to follow a similar pattern as shown in the Udacity tutorials</p>
  
  <p>Here is what I have
  Android Manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.android.simplecontentprovider"&gt;
  
       &lt;provider
          android:authorities="com.example.android.simplecontentprovider.app"
          android:name=".data.MyContentProvider" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".MainActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>ContentProvider:</p>
  
  <pre><code>  public class MyContentProvider extends ContentProvider {
  
      MyDatabaseHelper mOpenHelper;
  
      private static final int NAME = 1;
  
      // Creates a UriMatcher object.
      private static final UriMatcher sUriMatcher = buildUriMatcher();
  
      static UriMatcher buildUriMatcher() {
  
          final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
          final String authority = MyDataContract.CONTENT_AUTHORITY; // Value = com.example.android.simplecontentprovider.app
  
          matcher.addURI(authority, MyDataContract.PATH_TABLE, NAME); //PATH_TABLE = tblUserData
          //matcher.addURI(authority, MyDataContract.PATH_TABLE + "/*", NAME);
  
          return matcher;
      }
  
      @Override
      public boolean onCreate() {
          mOpenHelper = new MyDatabaseHelper(getContext());
          return true;
      }
  
      @Override
      public Cursor query(Uri uri, String[] strings, String s, String[] strings1, String s1) {
          return null;
      }
  
      @Override
      public String getType(Uri uri) {
  
          int match = sUriMatcher.match(uri);
          switch (match){
              case NAME:
                  return MyDataContract.UserDetailsEntry.CONTENT_TYPE;
              default:
                  throw new UnsupportedOperationException("UNKNOWN URI: " + uri);
          }
  
      }
  
      @Override
      public Uri insert(Uri uri, ContentValues contentValues) {
          final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
          final int match = sUriMatcher.match(uri);
          Uri returnUri;
  
          switch (match) {
              case NAME: {
                  long _id = db.insert(MyDataContract.UserDetailsEntry.TABLE_NAME, null, contentValues);
                  if ( _id &gt; 0 )
                      returnUri = MyDataContract.UserDetailsEntry.buildtblUserDetailsUri(_id);
                  else
                      throw new android.database.SQLException("Failed to insert row into " + uri);
                  break;
              }
              default:
                  throw new UnsupportedOperationException("Unknown uri: " + uri);
          }
          getContext().getContentResolver().notifyChange(uri, null);
          return returnUri;
      }
  
      @Override
      public int delete(Uri uri, String s, String[] strings) {
          return 0;
      }
  
      @Override
      public int update(Uri uri, ContentValues contentValues, String s, String[] strings) {
          return 0;
      }
  }
  </code></pre>
  
  <p>and finally the MainActivity</p>
  
  <pre><code>ContentResolver resolver = getContentResolver();
  
      Uri uri = MyDataContract.UserDetailsEntry.buildtblUserDetailsAll("MyTestName");
  
      Log.e("RESOLVER URI: ", uri.toString());
  
      ContentValues values = new ContentValues();
      values.put(MyDataContract.UserDetailsEntry.COLUMN_NAME, "MyTestName");
  
      try {
          resolver.insert(uri, values);
      }catch (Exception e){
          Log.e("RESOLVER INSERT: ", e.toString());
      }
  </code></pre>
  
  <p>When I run it through the debugger I get this message:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Unknown URL content://com.example.android.simplecontentprovider.app/tblUserData/MyTestName
  </code></pre>
  
  <p>this is the default value for the insert in the content provider. I am not sure if I am missing the authority part </p>