Android Intent Create intentDIY(Activity activity, Class classes, Map paramMap, int enterAnim, int exitAnim)

Here you can find the source of intentDIY(Activity activity, Class classes, Map paramMap, int enterAnim, int exitAnim)

Description

intent DIY

Declaration

public static void intentDIY(Activity activity, Class<?> classes,
            Map<String, String> paramMap, int enterAnim, int exitAnim) 

Method Source Code

//package com.java2s;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import android.app.Activity;
import android.content.Intent;

public class Main {
    public static int DEFAULT_ENTER_ANIM;
    public static int DEFAULT_EXIT_ANIM;
    private static Intent intent;

    public static void intentDIY(Activity activity, Class<?> classes) {
        intentDIY(activity, classes, null, DEFAULT_ENTER_ANIM,
                DEFAULT_EXIT_ANIM);/*from  w  w w.  java2 s  . c  o m*/
    }

    public static void intentDIY(Activity activity, Class<?> classes,
            Map<String, String> paramMap) {
        intentDIY(activity, classes, paramMap, DEFAULT_ENTER_ANIM,
                DEFAULT_EXIT_ANIM);
    }

    public static void intentDIY(Activity activity, Class<?> classes,
            int enterAnim, int exitAnim) {
        intentDIY(activity, classes, null, enterAnim, exitAnim);
    }

    public static void intentDIY(Activity activity, Class<?> classes,
            Map<String, String> paramMap, int enterAnim, int exitAnim) {
        intent = new Intent(activity, classes);
        organizeAndStart(activity, classes, paramMap);
        if (enterAnim != 0 && exitAnim != 0) {
            activity.overridePendingTransition(enterAnim, exitAnim);
        }
    }

    private static void organizeAndStart(Activity activity,
            Class<?> classes, Map<String, String> paramMap) {
        intent = new Intent(activity, classes);
        if (null != paramMap) {
            Set<String> set = paramMap.keySet();
            for (Iterator<String> iterator = set.iterator(); iterator
                    .hasNext();) {
                String key = iterator.next();
                intent.putExtra(key, paramMap.get(key));
            }
        }
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        activity.startActivity(intent);
    }
}

Related

  1. putParamters(Intent intent, Object[] parameters)
  2. intentCall(Activity activity, String phoneNumber)
  3. intentDIY(Activity activity, Class classes)
  4. intentDIY(Activity activity, Class classes, Map paramMap)
  5. intentDIY(Activity activity, Class classes, int enterAnim, int exitAnim)
  6. getCameraIntent(String outputFile)
  7. getUrifromIntent(Intent data, Uri outputFileUri)
  8. createContactAppIntent()
  9. sendBroadcast(Context c, Intent i, boolean local)