Code example for ContentProvider

Methods: insert

0
					childId = ContentUris.parseId(newItem);
 
				// no existing child or relation 
				}else{ 
					if (mToContentUri != null){
						newItem = provider.insert(mToContentUri, values);
						childId = ContentUris.parseId(newItem);
					}else{ 
						childId = db.insert(mToTable, null, values);
						if (childId != -1){
							newItem = ContentUris.withAppendedId(parentChildDir, childId);
						} 
					} 
				} 
 
				if (newItem != null && childId != -1){
					addRelation(db, parentId, childId);
				} 
 
				db.setTransactionSuccessful();
			}finally{