ReposClient.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:orgzly-android 作者:
/**
 * Since old repository URL could be used, do not actually update the existing record,
 * but create a new one.
 */
public static int updateUrl(Context mContext, long id, String url) {
    ArrayList<ContentProviderOperation> ops = new ArrayList<>();

    ops.add(ContentProviderOperation
                    .newDelete(ContentUris.withAppendedId(ProviderContract.Repos.ContentUri.repos(), id))
                    .build());

    ops.add(ContentProviderOperation
                    .newInsert(ProviderContract.Repos.ContentUri.repos())
                    .withValue(ProviderContract.Repos.Param.REPO_URL, url)
                    .build());

    try {
        mContext.getContentResolver().applyBatch(ProviderContract.AUTHORITY, ops);
    } catch (RemoteException | OperationApplicationException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }

    return 1;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号