title: Inserting an array using ContentProvider
body: <p>I have a web service which returns the profile of the user upon successful authentication. The profile is in JSON and looks like this:  </p>
  
  <pre><code>{
    "first_name" : "John",
    "last_name" : "Doe",
    "interests: : ["Science","Sports"]
  }  
  </code></pre>
  
  <p>How can I persist this in the database using a <code>ContentProvider</code>?  </p>
  
  <p><code>ContentValues</code> do not have any provision for handling multi-valued attribute. My current implementation looks like this:  </p>
  
  <pre><code>@Override
  public Uri insert(Uri uri, ContentValues values){
      switch(matcher.match(uri)){
          case NEW_PROFILE:
          break;
          default:
          return null;
      }
      ProfileDatabaseHelper helper = new ProfileDatabaseHelper();
      // delete the existing profile first
      helper.deleteUserProfile();
      // then add a new profile
      long id = helper.addUserProfile( values );
      if( id &gt; -1 ){
          Uri insertedId = ContentUris.withAppendedId(CONTENT_URI,id);
          getContext().getContentResolver().notifyChange(insertedId,null);
          return insertedId;
      }else{
          return null;
      }
  }
  </code></pre>