没有合适的资源?快使用搜索试试~ 我知道了~
Android-Intents-2.
需积分: 10 1 下载量 131 浏览量
2015-08-01
16:00:27
上传
评论
收藏 695KB PDF 举报
温馨提示
试读
17页
Android-Intents-2 part 2
资源推荐
资源详情
资源评论
© 2012 Marty Hall
Customized Java EE Training: http://courses.coreservlets.com/
Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jQuery, Spring, Hibernate, RESTful Web Services, Hadoop, Android.
Developed and taught by well-known author and developer. At public venues or onsite at your location.
Intents, Intent Filters,
and Invoking Activities:
Part II: Using URI
Originals of Slides and Source Code for Examples:
http://www.coreservlets.com/android-tutorial/
© 2012 Marty Hall
Customized Java EE Training: http://courses.coreservlets.com/
Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jQuery, Spring, Hibernate, RESTful Web Services, Hadoop, Android.
Developed and taught by well-known author and developer. At public venues or onsite at your location.
For live Android training, please see courses
at http://courses.coreservlets.com/.
Taught by the author of Core Servlets and JSP, More
Servlets and JSP, and this Android tutorial. Available at
public venues, or customized versions can be held
on-site at your organization.
• Courses developed and taught by Marty Hall
– JSF 2, PrimeFaces, servlets/JSP, Ajax, jQuery, Android development, Java 6 or 7 programming, custom mix of topics
– Ajax courses can concentrate on 1 library (jQuery, Prototype/Scriptaculous, Ext-JS, Dojo, etc.) or survey several
• Courses developed and taught by coreservlets.com experts (edited by Marty)
– Spring, Hibernate/JPA, EJB3, GWT, Hadoop, SOAP-based and RESTful Web Services
Contact hall@coreservlets.com for details
Topics in This Section
• Part I
– Invoking Activities by class name
– Defining dimensions in res/values
– Sending data via the “extras” Bundle
• Part II
– Invoking Activities with a URI
– Sending data via parameters in the URI
• Part III
– Invoking Activities with tabbed windows
– Defining two-image icons in res/drawable
4
© 2012 Marty Hall
Customized Java EE Training: http://courses.coreservlets.com/
Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jQuery, Spring, Hibernate, RESTful Web Services, Hadoop, Android.
Developed and taught by well-known author and developer. At public venues or onsite at your location.
Overview
Summary of Options
• Invoke Activity by class name (Part I)
– Exactly one Activity can match
– New Activity must be in same project as original
– Can send data via an “extras” Bundle
• Invoke Activity by URI (Part II)
– More than one Activity could match
– New Activity need not be in the same project as original
– Can send data via URI parameters or “extras” Bundle
• Switch Activities via tabs (Part III)
– Can use class name or URI to specify Activity
– New Activity must be in same project as original
– Can send data via URI parameters or “extras” Bundle
6
© 2012 Marty Hall
Customized Java EE Training: http://courses.coreservlets.com/
Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jQuery, Spring, Hibernate, RESTful Web Services, Hadoop, Android.
Developed and taught by well-known author and developer. At public venues or onsite at your location.
Invoking Activities
with a URI
Summary
• Idea
– Supply a URI that indirectly refers to new Activity. The new Activity
registers as target for URIs of a certain form.
• The originating Activity and the new Activity need not be in the same project
• More than one Activity could match the URI.
– If so, Android will ask you which one to use.
• Syntax
– Java (original Activity)
Uri uri = Uri.parse("foo://bar.example.com/baz");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(activityIntent);
– XML (AndroidManifest.xml)
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="foo" android:host="bar.example.com" />
</intent-filter>
8
Registering to Handle URIs
• Matching the URI itself
– Register for a scheme and a host
• Example URI
– loan://coreservlets.com/calc
• intent-filter entry
– <data android:scheme="loan" android:host="coreservlets.com" />
– Note that the “calc” part is arbitrary – just to make URL look better.
• Matching the data type
– Register for a MIME type
• Example URIs
– content:// (referring to that MIME type)
– file:// (referring to that MIME type)
– anything:// (the Intent can call setType to specify MIME type)
• intent-filter entry
– <data android:mimeType="some/type" />
– <data android:mimeType="something/*" />
9
剩余16页未读,继续阅读
资源评论
jerome_wang
- 粉丝: 4
- 资源: 39
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功