当前位置: 代码迷 >> Android >> Android FragmentActivity Intent 跳转打包
  详细解决方案

Android FragmentActivity Intent 跳转打包

热度:138   发布时间:2016-04-28 03:20:31.0
Android FragmentActivity Intent 跳转封装
package com.innjoo.store.utils;import com.innjoo.store.R;import android.content.ActivityNotFoundException;import android.content.Intent;import android.support.v4.app.FragmentActivity;public class IntentUtils {	private static Intent intent;	private static final Object lock = new Object();	public static final int ENTER = 0, OUT = 1, NOTRANSITION = -1;	/**	 * 	 * @Title: startActivityEnter	 * @Description: TODO 跳转进入	 * @return void	 * @throws	 * @author 重播	 * @email [email protected]	 * @date 2014-12-18 上午10:05:16	 */	public static <T> void startActivity(int inOrOut,			FragmentActivity activity, Class<T> class1, String key,			Object object) {		// TODO Auto-generated method stub		synchronized (lock) {			try {				intent = new Intent(activity, class1);				if (object != null && object instanceof String) {					intent.putExtra(key, (String) object);				} else if (object != null && object instanceof Integer) {					intent.putExtra(key, (Integer) object);				}				activity.startActivity(intent);				switch (inOrOut) {				case ENTER:					activity.overridePendingTransition(							R.anim.activity_right_in, R.anim.activity_left_out);					break;				case OUT:					activity.overridePendingTransition(R.anim.activity_left_in,							R.anim.activity_right_out);					break;				default:					break;				}			} catch (ActivityNotFoundException e) {			}		}	}}

  相关解决方案