创建浏览器书签从应用程序 [英] Create Browser-Bookmark from app

查看:138
本文介绍了创建浏览器书签从应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我自己的应用程序中创建的股票Android的浏览器中的书签。我怎样才能做到这一点?

I want to create a bookmark in the stock android-browser from my own application. How can I do this?

我只找到了 Browser.saveBookmark - 方法(<一href="http://developer.android.com/reference/android/provider/Browser.html#saveBookmark%28android.content.Context,%20java.lang.String,%20java.lang.String%29"相对=nofollow> API-DOC ),但是这将显示一个新的窗口,用户可以更改数据。当我想从外部数据源导入书签我想直接和没有保存书签询问用户输入。

I only found the Browser.saveBookmark-Method (api-doc) but this displays a new window where the user can change the data. As I want to import bookmarks from a external data-source I want to save the bookmark directly and not ask the user for input.

推荐答案

如果你只是想允许用户添加一个书签,的 android.provider.Browser .saveBookmark()是你想要什么。但它看起来像你想要做大规模的更新,所以这可能是不够的,因为它只是打开浏览器的书签页面。

If you just want to allow the user to add a bookmark, android.provider.Browser.saveBookmark() is what you want. But it looks like you're wanting to do mass updates, so that's probably not enough since it just opens the browser's bookmarks page.

AFAIK没有开放的API,它直接捆绑在浏览器的书签。然而,有一个内容解析器为它可接android.provider.Browser.BOOKMARKS_URI。一旦你解决提供商可以通过运行查询操作书签,只要你有com.android.browser.permission.READ_HISTORY_BOOKMARKS和com.android.browser.permission.WRITE_HISTORY_BOOKMARKS权限。

AFAIK there is no open API that ties directly into the browser's bookmarks. However, there is a content resolver for it which can be accessed android.provider.Browser.BOOKMARKS_URI. Once you've resolved the provider you can manipulate bookmarks by running queries, provided you have the com.android.browser.permission.READ_HISTORY_BOOKMARKS and com.android.browser.permission.WRITE_HISTORY_BOOKMARKS permissions.

如果你不熟悉的内容供应商,他们可以得到还挺多毛(加倍所以如果你不熟悉SQL)。然而,知识库对他们一些好文章,快速谷歌的Android的内容提供商教程应该让你对你的方式。

If you're unfamiliar with content providers, they can get kinda hairy (doubly so if you're unfamiliar with SQL). However, the knowledge base has some good articles on them, and a quick google for "android content provider tutorial" should get you well on your way.

这篇关于创建浏览器书签从应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆