@@ -0,0 +1,1228 @@
+package com.example.karthika.connect;%0A%0Aimport android.app.Activity;%0Aimport android.provider.Settings.Global;%0Aimport java.lang.ref.WeakReference;%0Aimport java.util.ArrayList;%0A%0A/**%0A * Created by karthika on 10/27/2015.%0A */%0Apublic class Constants %7B%0A    public static ArrayList%3CWeakReference%3CActivity%3E%3E activity_stack=new ArrayList%3CWeakReference%3CActivity%3E%3E();%0A    /**%0A     * Add the activity as weak reference to activity stack.%0A     * @param act%0A     */%0A    public static void addToActivityStack(Activity act)%0A    %7B%0A        WeakReference%3CActivity%3E ref = new WeakReference%3CActivity%3E(act);%0A        activity_stack.add(ref);%0A%0A    %7D%0A    /**%0A     * Kill all the activities on activity stack except act.%0A     * To kill all the passed parameter should be null.%0A     */%0A    public static void killAllExcept(Activity act)%0A    %7B%0A        for(WeakReference%3CActivity%3E ref: activity_stack)%0A        %7B%0A            if(ref != null && ref.get() != null)%0A            %7B%0A                if(act != null && ref.get().equals(act))%0A                %7B%0A                    continue;//dont finish this up.%0A                %7D%0A                ref.get().finish();%0A            %7D%0A        %7D%0A        activity_stack.clear();//but clear all the activity references%0A    %7D%0A%7D%0A

Create Constants.java