没有合适的资源?快使用搜索试试~ 我知道了~
Android-Intents part 1
资源推荐
资源详情
资源评论
© 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 I: Using Class Name
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
5
© 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
Idea
• Android philosophy
– Activities are small, single-screen units
• Consequence
– You need easy way to switch from one Activity to
another
• Approach: use Intent
– An abstract description of an operation to be performed
– Intent can refer to class name of Activity or a URI
– If a URI, then Activity registers as handler for the
scheme, host name, or MIME type of the URI
– In all cases, new Activity must have entry in
AndroidManifest.xml in order to be invoked
7
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
8
© 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.
Example Target Activity:
Loan Payment Calculator
Example Target Activity:
Loan Calculator
• Inputs
– Loan amount
– Interest rate (as a percent)
– Loan period in months
• Outputs
– Monthly payment
– Total payments over life of loan
• Both are in same units
(e.g., dollars) as the loan amount
• Defaults
– Unless values are passed in from other Activity, uses
default values for all inputs
10
Summary of Layout
11
TableLayout
Entries in first column
are right-aligned.
Entries in second column are
left-aligned. They are also
given ids so that the Java
code can insert the text.
This is a View with
android:column_span="2"
and a fixed height.
XML: Layout File: First Row
(res/layout/loan_payment.xml)
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://..."
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1">
<TableRow android:layout_marginTop="20dp">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/default_foreground"
android:textSize="@dimen/font_size"
android:text="@string/loan_amount_prompt"
android:gravity="right"/>
<TextView android:id="@+id/loan_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/default_foreground"
android:textSize="@dimen/font_size"
android:gravity="left"/>
</TableRow>
12
Second and third rows are very similar. Bottom two rows are almost the same except for a different textColor for the second column.
剩余24页未读,继续阅读
资源评论
jerome_wang
- 粉丝: 4
- 资源: 39
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功