我可以更改正在运行的活动的 android:noHistory 属性吗?

发布于 2024-11-15 02:34:34 字数 253 浏览 0 评论 0原文

是否可以通过编程方式动态更改 Activity 的 android:noHistory 属性值?

或者也许有另一种方法可以做我想做的事。我有一个带有 QuickContactBadges 的活动...我希望它在弹出 QuickContact 后关闭该活动,这就是为什么我打开了 noHistory ,但该活动还启动了一个配置活动。我不希望它在从该活动回来时关闭(相反,它应该刷新,如果我可以阻止它关闭,我就可以做到这一点)。

Is it possible to change the value of the android:noHistory attribute of an Activity programmaticaly and on the fly?

Or maybe there is another way to do what I want. I have an activity with QuickContactBadges on it... I want it to close the activity when after popping up a QuickContact, which is why I have noHistory on, but the activity also launches a configuration activity. I do NOT want it to close when coming back from that activity (rather it should refresh, which I can do if I can stop it from closing).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

海未深 2024-11-22 02:34:34

修订后的答案

您可以从默认布尔值true开始,将其用作 Activity 的 onPause() 方法中的触发器来告诉您是否要调用finish()。如果用户到达 Activity 中调用配置 Activity 的部分,请将布尔值设置为 false,这样 Activity 就不会完成,也不会从堆栈中删除。

Revised Answer

You can start with a default boolean value of true to be used as a trigger in the onPause() method of your Activity to tell you whether or not you want to call finish(). If the user reaches the portion of your Activity that calls your Configuration Activity, set the boolean to false so the Activity will not be finished nor removed from the stack.

往日情怀 2024-11-22 02:34:34
<activity android:allowTaskReparenting=["true" | "false"]
          android:alwaysRetainTaskState=["true" | "false"]
          android:clearTaskOnLaunch=["true" | "false"]
          android:configChanges=["mcc", "mnc", "locale",
                                 "touchscreen", "keyboard", "keyboardHidden",
                                 "navigation", "orientation", "screenLayout",
                                 "fontScale", "uiMode"]
          android:enabled=["true" | "false"]
          android:excludeFromRecents=["true" | "false"]
          android:exported=["true" | "false"]
          android:finishOnTaskLaunch=["true" | "false"]
          android:hardwareAccelerated=["true" | "false"]
          android:icon="drawable resource"
          android:label="string resource"
          android:launchMode=["multiple" | "singleTop" |
                              "singleTask" | "singleInstance"]
          android:multiprocess=["true" | "false"]
          android:name="string"
          android:noHistory=["true" | "false"]  
          android:permission="string"
          android:process="string"
          android:screenOrientation=["unspecified" | "user" | "behind" |
                                     "landscape" | "portrait" |
                                     "sensor" | "nosensor"]
          android:stateNotNeeded=["true" | "false"]
          android:taskAffinity="string"
          android:theme="resource or theme"
          android:windowSoftInputMode=["stateUnspecified",
                                       "stateUnchanged", "stateHidden",
                                       "stateAlwaysHidden", "stateVisible",
                                       "stateAlwaysVisible", "adjustUnspecified",
                                       "adjustResize", "adjustPan"] >   
    . . .
</activity>

试试这个链接->http://developer.android.com/guide/topics/manifest/activity-element.html

<activity android:allowTaskReparenting=["true" | "false"]
          android:alwaysRetainTaskState=["true" | "false"]
          android:clearTaskOnLaunch=["true" | "false"]
          android:configChanges=["mcc", "mnc", "locale",
                                 "touchscreen", "keyboard", "keyboardHidden",
                                 "navigation", "orientation", "screenLayout",
                                 "fontScale", "uiMode"]
          android:enabled=["true" | "false"]
          android:excludeFromRecents=["true" | "false"]
          android:exported=["true" | "false"]
          android:finishOnTaskLaunch=["true" | "false"]
          android:hardwareAccelerated=["true" | "false"]
          android:icon="drawable resource"
          android:label="string resource"
          android:launchMode=["multiple" | "singleTop" |
                              "singleTask" | "singleInstance"]
          android:multiprocess=["true" | "false"]
          android:name="string"
          android:noHistory=["true" | "false"]  
          android:permission="string"
          android:process="string"
          android:screenOrientation=["unspecified" | "user" | "behind" |
                                     "landscape" | "portrait" |
                                     "sensor" | "nosensor"]
          android:stateNotNeeded=["true" | "false"]
          android:taskAffinity="string"
          android:theme="resource or theme"
          android:windowSoftInputMode=["stateUnspecified",
                                       "stateUnchanged", "stateHidden",
                                       "stateAlwaysHidden", "stateVisible",
                                       "stateAlwaysVisible", "adjustUnspecified",
                                       "adjustResize", "adjustPan"] >   
    . . .
</activity>

try this link->http://developer.android.com/guide/topics/manifest/activity-element.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文