Code example for ContentResolver

Methods: applyBatch

0
     * given {@link ContentResolver}. 
     */ 
    public void parseAndApply(XmlPullParser parser, ContentResolver resolver)
            throws HandlerException { 
        try { 
            final ArrayList<ContentProviderOperation> batch = parse(parser, resolver);
            resolver.applyBatch(mAuthority, batch);
 
        } catch (HandlerException e) {
            throw e;
        } catch (XmlPullParserException e) {
            throw new HandlerException("Problem parsing XML response", e);
        } catch (IOException e) {
            throw new HandlerException("Problem reading response", e);
        } catch (RemoteException e) {
            // Failed binder transactions aren't recoverable 
            throw new RuntimeException("Problem applying batch operation", e);
        } catch (OperationApplicationException e) {
            // Failures like constraint violation aren't recoverable 
            // TODO: write unit tests to exercise full provider 
            // TODO: consider catching version checking asserts here, and then