My Android Step-by-step tour------>android A simple package for activity management

Source: Internet
Author: User

All activity is managed by a collection class, enabling you to control activity at any time. Add activity to list using the Add Activity method, remove activity from list using the Remove activity method, using Finishprogram () Method removes all activity from the list and exits the program

Import Java.util.arraylist;import java.util.list;import Android.app.activity;import Android.util.log;public class Activitystackcontrolutil {private static list<activity> activitylist = new arraylist<activity> ();p ublic static void Remove (activity activity) {activitylist.remove (activity);} public static void Add (activity activity) {Activitylist.add (activity);} public static void Finishprogram () {log.i ("Oyp", "Finishprogram"), and for (Activity activity:activitylist) {if (!activity.i Sfinishing ()) {activity.finish ();}} Android.os.Process.killProcess (Android.os.Process.myPid ());}}


====================================================================================

Ouyangpeng welcome reprint, sharing with people is the source of progress!

Reprint please keep the original address : Http://blog.csdn.net/ouyang_peng

====================================================================================

Copyright NOTICE: This article for Bo Master original article, welcome reprint, reprint please indicate source Http://blog.csdn.net/ouyang_peng

My Android Step-by-step tour------>android A simple package for activity management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.