Code example for ContentProviderClient

Methods: query

0
         * @throws RemoteException if there is a failure communicating with the remote 
         * {@link android.content.ContentProvider} 
         */ 
        public static byte[] get(ContentProviderClient provider, Uri uri,
                Account account) throws RemoteException {
            Cursor c = provider.query(uri, DATA_PROJECTION, SELECT_BY_ACCOUNT,
                    new String[]{account.name, account.type}, null);
 
            // Unable to query the provider 
            if (c == null) {
                throw new RemoteException();
            } 
 
            try { 
                if (c.moveToNext()) {
                    return c.getBlob(c.getColumnIndexOrThrow(Columns.DATA));
                } 
            } finally { 
                c.close();
            } 
Experience pair programming with AI  Get Codota for Java