Android examples for Intent:Open App
Get the intent to start fragment.
//package com.java2s; import android.content.Context; import android.content.Intent; import android.os.Bundle; public class Main { public static final String FRAGMENT_ARGS = "fragment_arg"; public static final String FRAGMENT_NAME = "fragment_name"; public static final String FRAGMENT_TAG = "fragment_tag"; /**/*from ww w . j a v a 2 s . c o m*/ * Get the intent to start fragment. * * @param context * @param clss * @param fragmentName * @param fragmentTag * @param args * @return */ public static Intent getIntent(Context context, Class<?> clss, String fragmentName, String fragmentTag, Bundle args) { Intent intent = new Intent(context, clss); Bundle bundle = new Bundle(); bundle.putString(FRAGMENT_NAME, fragmentName); bundle.putString(FRAGMENT_TAG, fragmentTag); bundle.putBundle(FRAGMENT_ARGS, args); intent.putExtras(bundle); return intent; } }