English 中文(简体)
1. 总结以往从目前活动开始的任何活动?
原标题:Finish any previous activity in stack from current activity?
  • 时间:2010-04-27 14:24:01
  •  标签:
  • android

如何完成以前在申请中的任何活动(在任何级别,我指的是不是直系亲属),从目前的活动中,如某些特定事件,我想使以前的活动无效? 任何帮助? 感谢。

最佳回答

This may be possible by using static variables. Like use a boolean variable activity_name_dirty = false; mark this as true as soon as your condition of invalidating that particular activity occurs. So any time later when calling this activity have a check on the state of activity_name_dirty. You may then use Activity Flags to create a new instant as described in Activity Fundamentals

问题回答

我知道这一答案可能是很晚的,但是,如果有人正在寻找像这样的东西,我仍然要说。

我在<代码>上宣布了静态手稿。 ACTIVability_A

public static Handler h;

www.un.org/Depts/DGACM/index_french.htm 我

h = new Handler() {

        public void handleMessage(Message msg) {
            super.handleMessage(msg);

            switch(msg.what) {

            case 0:
                ACTIVITY_A = null;
                finish();
                break;

            }
        }
        
    };

现在,从此以后的任何活动,例如。 ACTIVability_B, or ACTIVITY_C 我可以打电话

ACTIVITY_A.h.sendEmptyMessage(0);

然后在<条码>上打<条码>。 <代码>ACTIVITY_A由不同的活动完成。

因此,我退休了,但在我进行了更深入的测试之后,做了一些工作(我在此请今后参考:android:clearTaskOnLaunch)。

例如,证明有人发射活动 从家庭屏幕到活动Q。 用户下台新闻社,然后返回P活动。 通常,用户会看到活动Q,因为这是他们最后一次从事P s任务。 然而,如果P将这一旗帜定为“真实”,那么当用户在家报到时,该旗帜上的所有活动(此处为Q)都被拆除。 因此,用户在返回任务时只看到P。

rel=“noreferer”>https://developer.android.com/guide/topics/maniap/active-element.html

UPDATE This did work

Intent intent = new Intent(this, MyActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);

您可以使用“旗帜”栏目,重新开始从栏目中开展活动,并澄清上面的所有事项。 这完全是你要求的,但它可能有所帮助。

为此使用:

Intent intent = new Intent(context, classToBeStarted.class);
intent.setFlag(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签