- 浏览: 132074 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
memoryisking:
可以看看这篇文章,构建一个简单的线程池,这个是struts教程 ...
java 线程池示例(自己实现的参考别人的代码) -
zwq194:
坑爹啊,误导人,代码有问题
java 线程池示例(自己实现的参考别人的代码) -
zhouming4455:
貌似你传错了哦
java 线程池示例(自己实现的参考别人的代码)
Intent FLAG详解
If set, this activity will become the start of a new task on this history stack.
A task (from the activity that started it to the next task activity) defines an
atomic group of activities that the user can move to. Tasks can be moved to the
foreground and background; all of the activities inside of a particular task
always remain in the same order. See the Application Model documentation for
more details on tasks.
This flag is generally used by activities that want to present a "launcher" style
behavior: they give the user a list of separate things that can be done, which
otherwise run completely independently of the activity launching them.
When using this flag, if a task is already running for the activity you are now
starting, then a new activity will not be started; instead, the current task will
simply be brought to the front of the screen with the state it was last in. See
FLAG_ACTIVITY_MULTIPLE_TASK for a flag to disable this behavior.
This flag can not be used when the caller is requesting a result from the activity being launched.
Constant Value: 268435456 (0x10000000)
public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT
This flag is not normally set by application code, but set for
you by the system as described in the launchMode documentation for the singleTask mode.
Constant Value: 4194304 (0x00400000)
public static final int FLAG_ACTIVITY_CLEAR_TOP
If set, and the activity being launched is already running in
the current task, then instead of launching a new instance of
that activity, all of the other activities on top of it will
be closed and this Intent will be delivered to the (now on top)
old activity as a new Intent.
For example, consider a task consisting of the activities: A, B, C, D. If D calls
startActivity() with an Intent that resolves to the component of activity B,
then C and D will be finished and B receive the given Intent, resulting in the stack now being: A, B.
The currently running instance of task B in the above example will either
receiving the new intent you are starting here in its onNewIntent() method,
or be itself finished and restarting with the new intent. If it has declared
its launch mode to be "multiple" (the default) it will be finished and
re-created; for all other launch modes it will receive the Intent in the current instance.
This launch mode can also be used to good effect in conjunction
with FLAG_ACTIVITY_NEW_TASK: if used to start the root activity of a task,
it will bring any currently running instance of that task to the foreground,
and then clear it to its root state. This is especially useful, for example,
when launching an activity from the notification manager.
See the Application Model documentation for more details on tasks.
Constant Value: 67108864 (0x04000000)
public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
If set, the new activity is not kept in the list of recently
launched activities.
Constant Value: 8388608 (0x00800000)
public static final int FLAG_ACTIVITY_FORWARD_RESULT
If set and this intent is being used to launch a new activity
from an existing one, then the reply target of the existing
activity will be transfered to the new activity. This way the
new activity can call setResult(int) and have that result sent
back to the reply target of the original activity.
Constant Value: 33554432 (0x02000000)
public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
If set, this activity is being launched from history (longpress home key).
Constant Value: 1048576 (0x00100000)
public static final int FLAG_ACTIVITY_MULTIPLE_TASK
Do not use this flag unless you are implementing your own top-level
application launcher. Used in conjunction with FLAG_ACTIVITY_NEW_TASK
to disable the behavior of bringing an existing task to the foreground.
When set, a new task is always started to host the Activity for the Intent,
regardless of whether there is already an existing task running the same thing.
Because the default system does not include graphical task management,
you should not use this flag unless you provide some way for a user to
return back to the tasks you have launched.
This flag is ignored if FLAG_ACTIVITY_NEW_TASK is not set.
See the Application Model documentation for more details on tasks.
Constant Value: 134217728 (0x08000000)
public static final int FLAG_ACTIVITY_NEW_TASK
If set, this activity will become the start of a new
task on this history stack. A task (from the activity that
started it to the next task activity) defines an atomic group
of activities that the user can move to. Tasks can be moved to
the foreground and background; all of the activities inside of a
particular task always remain in the same order. See the Application
Model documentation for more details on tasks.
This flag is generally used by activities that want to present
a "launcher" style behavior: they give the user a list of separate
things that can be done, which otherwise run completely independently
of the activity launching them.
When using this flag, if a task is already running for the activity you
are now starting, then a new activity will not be started; instead, the
current task will simply be brought to the front of the screen with the
state it was last in. See FLAG_ACTIVITY_MULTIPLE_TASK for a flag to disable this behavior.
This flag can not be used when the caller is requesting a result from the activity being launched.
Constant Value: 268435456 (0x10000000)
public static final int FLAG_ACTIVITY_NO_HISTORY
If set, the new activity is not kept in the history stack.
Constant Value: 1073741824 (0x40000000)
public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP
If set and this intent is being used to launch a new activity
from an existing one, the current activity will not be counted
as the top activity for deciding whether the new intent should be
delivered to the top instead of starting a new one. The previous
activity will be used as the top, with the assumption being that
the current activity will finish itself immediately.
Constant Value: 16777216 (0x01000000)
public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
If set, and this activity is either being started in a new task or
bringing to the top an existing task, then it will be launched as
the front door of the task. This will result in the application of
any affinities needed to have that task in the proper state
(either moving activities to or from it), or simply resetting that
task to its initial state if needed.
Constant Value: 2097152 (0x00200000)
public static final int FLAG_ACTIVITY_SINGLE_TOP
If set, the activity will not be launched if it is
already running at the top of the history stack.
Constant Value: 536870912 (0x20000000)
public static final int FLAG_DEBUG_LOG_RESOLUTION
A flag you can enable for debugging: when set, log messages
will be printed during the resolution of this intent to show
you what has been found to create the final resolved list.
Constant Value: 8 (0x00000008)
public static final int FLAG_FROM_BACKGROUND
Can be set by the caller to indicate that this Intent is
coming from a background operation, not from direct user interaction.
Constant Value: 4 (0x00000004)
public static final int FLAG_GRANT_READ_URI_PERMISSION
If set, the recipient of this Intent will be granted permission
to perform read operations on the Uri in the Intent's data.
Constant Value: 1 (0x00000001)
public static final int FLAG_GRANT_WRITE_URI_PERMISSION
If set, the recipient of this Intent will be granted permission
to perform write operations on the Uri in the Intent's data.
Constant Value: 2 (0x00000002)
public static final int FLAG_RECEIVER_REGISTERED_ONLY
If set, when sending a broadcast only registered receivers will be
called -- no BroadcastReceiver components will be launched.
Constant Value: 1073741824 (0x40000000)
FLAG_ACTIVITY_BROUGHT_TO_FRONT
This flag is not normally set by application code, but set for you by the system for the singleTask mode activity.
FLAG_ACTIVITY_CLEAR_TOP
砍掉本任务栈里在被启动Activity之上的所有Activity。For example, consider a task consisting of the activities: A, B, C, D. If D calls startActivity() with an Intent that resolves to the component of activity B, then C and D will be finished and B receive the given Intent, resulting in the stack now being: A, B. 此时如果Activity B的启动模式是默认的multiple,且没有设置FLAG_ACTIVITY_SINGLE_TOP,
那么B会被结束并重建,反之B的onNewIntent()会被调用,不用重建。如果和FLAG_ACTIVITY_NEW_TASK
搭配,则会在别的任务栈(优先选择后台任务栈,其次考虑新建任务栈)里产生同样效果,这点很有用,比如用在Notification
manager里启动一个Activity。
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
如果设置,这将在Task的Activity stack中设置一个还原点,当Task恢复时,需要清理Activity。也就是说,下一次Task带着 FLAG_ACTIVITY_RESET_TASK_IF_NEEDED标记进入前台时(典型的操作是用户在主画面重启它),这个Activity和它之 上的都将关闭,以至于用户不能再返回到它们,但是可以回到之前的Activity。这在你的程序有分割点的时候很有用。例如,一个e-mail应用程序可能有一个操作是查看一个附件,需要启动图片浏览Activity来显示。这个 Activity应该作为e-mail应用程序Task的一部分,因为这是用户在这个Task中触发的操作。然而,当用户离开这个Task,然后从主画面 选择e-mail app,我们可能希望回到查看的会话中,但不是查看图片附件,因为这让人困惑。通过在启动图片浏览时设定这个标志,浏览及其它启动的Activity在下 次用户返回到mail程序时都将全部清除。
FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
如果设置,新的Activity不会在最近启动的Activity的列表中保存。FLAG_ACTIVITY_FORWARD_RESULT如果设置,并且这个Intent用于从一个存在的Activity启动一个新的Activity,那么,这个作为答复目标的Activity将会传 到这个新的Activity中。这种方式下,新的Activity可以调用setResult(int),并且这个结果值将发送给那个作为答复目标的 Activity。总而言之,当一个結果需要运行多个Activity才能得到时用这个flag来传递答复目标。
FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
通常由系统来设置这个flag,if this activity is being launched from history (longpress home key)。FLAG_ACTIVITY_MULTIPLE_TASK
不要使用这个标志,除非你自己实现了应用程序启动器。与FLAG_ACTIVITY_NEW_TASK结合起来使用,可以禁用把已存的Task送入前台的行为。当设置时,新的Task总是会启动来处理Intent,而不管这是是否已经有一个Task可以处理相同的事情。经 过实践,当Activity的launchMode为singleStask时此flag无效,还是把已经启动过的那个Activity放到前台,因此相 信singleInstance的Activity同样无效。这是合理的,因为这两种lauchMode的Activity本来在全局范围内就只能有一个 实例。
由于默认的系统不包含图形Task管理功能,因此,你不应该使用这个标志,除非你提供给用户一种方式可以返回到已经启动的Task。
如果FLAG_ACTIVITY_NEW_TASK标志没有设置,这个标志被忽略。
FLAG_ACTIVITY_NEW_TASK
如果设置,这个Activity会在一个新建Task的栈顶启动(这是不一定的,只有该Activity的taskAffinity和当前所有Task(包括当前Task)的affinity不匹配时才成立)。一个Task(从启动它的Activity到下一个Task中的Activity)定义了用户可以迁移的Activity原子组。Task可以移动到前台和后台;在某个特定Task中的所有Activity总是保持相同的次序。这个标志一般用于呈现“启动”类型的行为:它们提供用户一系列可以单独完成的事情,与启动它们的Activity完全无关。
使用这个标志,如果正在启动的Activity的Task(即以此Activity为栈底的Task)已经在运行的话,那么,新的Activity将不会启动,代替的,这个Task会简单的移入前台(如果它已经在前台的话就什么都不会发生)。参考FLAG_ACTIVITY_MULTIPLE_TASK标志,可以禁用这一行为。如果没有以此Activity为栈底的Task在运行的话就会在一个有相同affinity的Task(没有就新建Task)的栈顶启动此Activity。
这个标志不能用于调用方为了请求結果而启动Activity。因为被启动的Activity和调用方不在同一个进程中,调用方会收到RESULT_CANCELED。
FLAG_ACTIVITY_NO_ANIMATION
在启动Activity的时候不要过渡动画。FLAG_ACTIVITY_NO_HISTOR
如果设置,新的Activity将不在任务栈中保留。用户一离开它,这个Activity就关闭了。这也可以通过设置noHistory特性。FLAG_ACTIVITY_SINGLE_TOP
If set, the activity will not be launched if it is already running at the top of the history stack. Instead the onNewIntent() will be called.发表评论
-
监听HOME键
2013-05-16 12:20 840class HomeKeyEventBroadCastR ... -
调用系统接口发送短信
2013-01-30 18:59 1179String smsContent = getwSMS(mRe ... -
调用android自带的联系人
2013-01-29 19:42 1032在android程序的开发中,经常要实现的一个功能是调用系统 ... -
横竖屏
2013-01-11 13:40 799总结: 1、不设置Activity的android:co ... -
代码调用menu
2013-01-10 09:17 1047<!-- @pa ... -
[转载]Android 浅谈ANR
2013-01-10 09:14 945一:什么是 ANR A ... -
Android TextView属性详解
2012-11-17 11:23 747android:autoLink设置是否当文本为URL链接/e ... -
[教程] 【转】Android 通过软引用实现图片缓存,防止内存溢出 [复制链接]
2012-09-22 19:18 4113public class BitmapCache { s ... -
Android使用Application总结
2012-09-22 11:56 824Android使用Application总结 ... -
raw文件夹下资源的访问
2012-09-21 16:50 13661: 重命名raw下资源的名字, 规则如下, 在每个资源文件的 ... -
Android自定义组件2转载
2012-09-18 22:10 849原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 ... -
自定义控件
2012-09-18 16:17 963<com.yulin.test.MyView ... -
onNewIntent()与singleTask启动模式
2012-09-18 10:52 3083... -
可以拖动的listview+限制拖动某一图片
2012-09-16 08:43 1053可以拖动的listview+限制拖动某一图片 p ... -
Android自定义属性,format详解
2012-09-14 18:20 6691. reference:参考某一资源ID。 ... -
Android实现可拖拽的ListView
2012-09-14 16:27 945通过继承 ListView 实现可拖拽的 ListVi ... -
Application共享全局变量和注册全局broadcast
2012-09-14 09:21 20myApplication extends Appli ... -
onSharedPreferenceChangeListener类
2012-09-13 17:02 2238onSharedPreferenceChangeListe ... -
enum用法
2012-09-13 14:42 856public class timeofdayManager { ... -
Android 4.0 Launcher2源码分析——启动过程分析
2012-09-12 13:43 895http://www.2cto.com/kf/201208/1 ...
相关推荐
- **Flags(标志位)**:设置Intent的运行模式,比如FLAG_ACTIVITY_NEW_TASK用于在新的任务栈中启动Activity。 3. **Intent Filter匹配过程** 当使用隐式Intent时,系统会遍历所有注册了Intent Filter的组件,...
标题与描述均指向了“Android各组件详解——Intent”,这一主题深入探讨了Android开发中至关重要的Intent组件。本文将从多个角度解析Intent的功能、应用场景及其内部结构,为开发者提供全面的理解。 ### Intent概述...
Intent详解(二)源码分析 Intent在Android系统中扮演着至关重要的角色,它是应用程序间通信(IPC,Inter-Process Communication)的主要手段。Intent不仅用于启动活动(Activity)、服务(Service),还可以用来...
### Android Intent跳转详解 在Android开发中,`Intent`是一种非常重要的机制,它主要用于启动新的活动(Activity)或者向其他组件发送消息。通过Intent,我们可以实现Activity之间的跳转、数据传递等功能,这对于...
Intent的Flags可以设置一些特殊行为,如`FLAG_ACTIVITY_NEW_TASK`用来开启新的任务栈,或者`FLAG_ACTIVITY_CLEAR_TOP`用于清除栈顶所有活动并返回到指定Activity。 6. Broadcast(广播) Intent同样用于发送...
### Android用于打开各种文件的Intent知识点详解 #### 一、概述 在Android开发过程中,我们经常需要使用`Intent`来启动应用内的特定功能或者跳转到其他应用来处理某些文件类型(如PDF、PPT、Word文档等)。本文将...
### Android Activity 的四种启动模式与 Intent.setFlags()详解 #### 一、Android Activity 四种启动模式 在 Android 应用开发中,Activity 是构成应用的基本单元之一,它负责显示用户界面并处理用户交互。为了更...
在实际编程中,应充分利用Intent的各种特性,如使用FLAG_ACTIVITY_NEW_TASK开启新的任务栈,或者使用FLAG_ACTIVITY_CLEAR_TOP清理栈顶Activity,以实现丰富的用户体验和流畅的应用流程。同时,合理设计Intent的...
例如,FLAG_ACTIVITY_NEW_TASK用于在新的任务栈中启动Activity,FLAG_ACTIVITY_CLEAR_TOP则会清除当前Activity之上的所有Activity,然后重新启动指定的Activity。 在处理Intent时,Android系统会根据Intent的内容和...
Intent的FLAG_ACTIVITY_CLEAR_TOP和FLAG_ACTIVITY_REORDER_TO_FRONT Activity的两种启动模式:FLAG_ACTIVITY_CLEAR_TOP和FLAG_ACTIVITY_REORDER_TO_FRONT 1. 如果已经启动了四个Activity:A,B,C和D。在D Activity...
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); ``` - **`Intent.FLAG_ACTIVITY_SINGLE_TOP`** - 如果当前任务栈的顶部已经存在目标`Activity`的实例,则直接复用这个实例,并调用...
但可以通过`FLAG_UPDATE_CURRENT`标志更新Intent中的Extra数据,而不会改变Intent的基本目标。 7. **广播的生命周期**:对于`GET_BROADCAST`模式的`PendingIntent`,需要注意的是,接收者可能无法接收到广播,因为...
8. **Intent Flag**:Intent的Flag可以控制Activity的行为,如FLAG_ACTIVITY_NEW_TASK用于创建新Task,FLAG_ACTIVITY_CLEAR_TOP则会清除所有位于目标Activity之上的Activity。 9. **Activity间的通信**:除了Intent...
### Android Activity与Intent详解 #### 一、Activity与Intent的基础概念 **Activity** 在 Android 开发中扮演着至关重要的角色,它是四大组件之一,代表了一个应用程序的用户界面的一部分。一个 Activity 通常...
Intent intent = new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0); // 设置NFC监听 nfcAdapter....
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); overridePendingTransition(R.anim.activity_in, R.anim.splash_out); } }; @Override public void onCreate(Bundle icicle) { ...
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent1); ``` 在上面的代码中,我们首先创建了一个 Intent 对象,然后将 ComponentName 对象设置到 Intent 中,并将其设置为新的任务。最后,...
开发者可以通过设置`FLAG_ACTIVITY_CLEAR_TOP`等标志来清理栈中的一部分或全部Activity。 **启动任务** 启动任务通常通过Intent来实现,Intent中携带的信息指导系统创建新的任务或重新激活已有的任务。通过设置...
- `FLAG_UPDATE_CURRENT`: 更新现有`PendingIntent`,保留原有请求码,更新Intent数据。 - `FLAG_ONE_SHOT`: 只使用一次,下次尝试使用时会被自动取消。 4. **权限控制**: `PendingIntent`具有权限保护,只有...