android developer tiny share-20160830
来源:互联网 发布:淘宝商品图片下载 编辑:程序博客网 时间:2024/05/16 09:33
今天讲使用intent打开搜索,包括特定app的上下文环境搜索和Web搜索。另外,再讲下使用intent打开相关的各种设置页面。
Search
Search using a specific app
To support search within the context of your app, declare an intent filter in your app with the SEARCH_ACTION action, as shown in the example intent filter below.
Action
"com.google.android.gms.actions.SEARCH_ACTION"
Support search queries from Google Voice Actions.
Extras
QUERY
A string that contains the search query.
Example intent filter:
<activity android:name=".SearchActivity"> <intent-filter> <action android:name="com.google.android.gms.actions.SEARCH_ACTION"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter></activity>
Perform a web search
To initiate a web search, use the ACTION_WEB_SEARCH action and specify the search string in the SearchManager.QUERY extra.
Action
ACTION_WEB_SEARCH
Data URI Scheme
None
MIME Type
None
Extras
SearchManager.QUERY
The search string.
Example intent:
public void searchWeb(String query) { Intent intent = new Intent(Intent.ACTION_SEARCH); intent.putExtra(SearchManager.QUERY, query); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); }}
Settings
Open a specific section of Settings
To open a screen in the system settings when your app requires the user to change something, use one of the following intent actions to open the settings screen respective to the action name.
Action
ACTION_SETTINGS
ACTION_WIRELESS_SETTINGS
ACTION_AIRPLANE_MODE_SETTINGS
ACTION_WIFI_SETTINGS
ACTION_APN_SETTINGS
ACTION_BLUETOOTH_SETTINGS
ACTION_DATE_SETTINGS
ACTION_LOCALE_SETTINGS
ACTION_INPUT_METHOD_SETTINGS
ACTION_DISPLAY_SETTINGS
ACTION_SECURITY_SETTINGS
ACTION_LOCATION_SOURCE_SETTINGS
ACTION_INTERNAL_STORAGE_SETTINGS
ACTION_MEMORY_CARD_SETTINGS
See the Settings documentation for additional settings screens that are available.
Data URI Scheme
None
MIME Type
None
Example intent:
public void openWifiSettings() { Intent intent = new Intent(Intent.ACTION_WIFI_SETTINGS); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); }}
- android developer tiny share-20160830
- android developer tiny share-20160627
- android developer tiny share-20160628
- android developer tiny share-20160629
- android developer tiny share-20160630
- android developer tiny share-20160701
- android developer tiny share-20160704
- android developer tiny share-20160705
- android developer tiny share-20160706
- android developer tiny share-20160707
- android developer tiny share-20160708
- android developer tiny share-20160711
- android developer tiny share-20160712
- android developer tiny share-20160713
- android developer tiny share-20160714
- android developer tiny share-20160715
- android developer tiny share-20160718
- android developer tiny share-20160719
- Go-Package
- SSH集成框架概述
- 树状数组(单点修改,区间询问)
- MyBatis,Spring整合简易教程
- eclipse编码格式全部正确,网页中文显示依旧乱码问题
- android developer tiny share-20160830
- mysqlWorkBench导入csv文件
- ASP.NET 重定向三种方法
- JavaSE学习_03_String_overload_recursion_break_continue
- div id与div class什么意思 用法讲解
- Servlet
- Android 7.0 新增功能&改进
- Visual Studio 2008 试用版评估期已结束的解决方法
- VS2010/MFC编程入门之四十一(文档、视图和框架:分割窗口)