English 中文(简体)
1. 与所有观点接近,在roid
原标题:Close all views with one action in android
  • 时间:2011-08-25 15:56:03
  •  标签:
  • android

I have a lot of Activities on top of each other in my application and I want to close all these activities in one click. Can we do that. And another thing is I want my application to start fresh each time(dont want to run in background). How can I do that?

最佳回答

I believe you can do it with this:

@Override
        public void onClick(View v)
        {
            Context context = v.getContext();
            Intent intent = new Intent(context, Dashboard.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);// This flag ensures all activities on top of the Dashboard are cleared.
            context.startActivity(intent);
        }

在本案中,我的达什板。 这一类是我申请的主要开端活动,因此,它使用户重新开始使用。

问题回答

不存在“封闭”应用程序或“安乐”活动。 请改为:。 是否公开申请?

如果你有许多活动类别,那么你可以审查

不能百分之百地确定有一种单一和roid的方法,将结束你的所有相关活动,但我认为,如果你使用广播和广播接收器,可能这样做。

例如,如果是你之一, 活动目前处于顶端,用户关闭,顶层活动可以播放一个密切的意向。 你们的所有其他活动都会让接受者听从这项活动,然后可以要求结束(......)。

每次开新鲜事都可能很复杂。 你们必须看看上去住家和背 but的县,但我对此表示强烈反对。 这也是由于你想要达到上述目的以及我所想的。





相关问题
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 ...

热门标签