android.support.v4.content.IntentCompat#makeMainActivity ( )源码实例Demo

下面列出了android.support.v4.content.IntentCompat#makeMainActivity ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MiBandDecompiled   文件: NavUtils.java
public static Intent getParentActivityIntent(Context context, ComponentName componentname)
{
    String s = getParentActivityName(context, componentname);
    if (s == null)
    {
        return null;
    }
    ComponentName componentname1 = new ComponentName(componentname.getPackageName(), s);
    if (getParentActivityName(context, componentname1) == null)
    {
        return IntentCompat.makeMainActivity(componentname1);
    } else
    {
        return (new Intent()).setComponent(componentname1);
    }
}
 
源代码2 项目: MiBandDecompiled   文件: NavUtils.java
public static Intent getParentActivityIntent(Context context, Class class1)
{
    String s = getParentActivityName(context, new ComponentName(context, class1));
    if (s == null)
    {
        return null;
    }
    ComponentName componentname = new ComponentName(context, s);
    if (getParentActivityName(context, componentname) == null)
    {
        return IntentCompat.makeMainActivity(componentname);
    } else
    {
        return (new Intent()).setComponent(componentname);
    }
}
 
源代码3 项目: CodenameOne   文件: NavUtils.java
@Override
public Intent getParentActivityIntent(Activity activity) {
    String parentName = NavUtils.getParentActivityName(activity);
    if (parentName == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(activity, parentName);
    try {
        final String grandparent = NavUtils.getParentActivityName(activity, target);
        final Intent parentIntent = grandparent == null
                ? IntentCompat.makeMainActivity(target)
                : new Intent().setComponent(target);
        return parentIntent;
    } catch (NameNotFoundException e) {
        Log.e(TAG, "getParentActivityIntent: bad parentActivityName '" + parentName +
                "' in manifest");
        return null;
    }
}
 
源代码4 项目: adt-leanback-support   文件: NavUtils.java
@Override
public Intent getParentActivityIntent(Activity activity) {
    String parentName = NavUtils.getParentActivityName(activity);
    if (parentName == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(activity, parentName);
    try {
        final String grandparent = NavUtils.getParentActivityName(activity, target);
        final Intent parentIntent = grandparent == null
                ? IntentCompat.makeMainActivity(target)
                : new Intent().setComponent(target);
        return parentIntent;
    } catch (NameNotFoundException e) {
        Log.e(TAG, "getParentActivityIntent: bad parentActivityName '" + parentName +
                "' in manifest");
        return null;
    }
}
 
源代码5 项目: android-recipes-app   文件: NavUtils.java
@Override
public Intent getParentActivityIntent(Activity activity) {
    String parentName = NavUtils.getParentActivityName(activity);
    if (parentName == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(activity, parentName);
    try {
        final String grandparent = NavUtils.getParentActivityName(activity, target);
        final Intent parentIntent = grandparent == null
                ? IntentCompat.makeMainActivity(target)
                : new Intent().setComponent(target);
        return parentIntent;
    } catch (NameNotFoundException e) {
        Log.e(TAG, "getParentActivityIntent: bad parentActivityName '" + parentName +
                "' in manifest");
        return null;
    }
}
 
源代码6 项目: V.FlyoutTest   文件: NavUtils.java
@Override
public Intent getParentActivityIntent(Activity activity) {
    String parentName = NavUtils.getParentActivityName(activity);
    if (parentName == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(activity, parentName);
    try {
        final String grandparent = NavUtils.getParentActivityName(activity, target);
        final Intent parentIntent = grandparent == null
                ? IntentCompat.makeMainActivity(target)
                : new Intent().setComponent(target);
        return parentIntent;
    } catch (NameNotFoundException e) {
        Log.e(TAG, "getParentActivityIntent: bad parentActivityName '" + parentName +
                "' in manifest");
        return null;
    }
}
 
源代码7 项目: guideshow   文件: NavUtils.java
@Override
public Intent getParentActivityIntent(Activity activity) {
    String parentName = NavUtils.getParentActivityName(activity);
    if (parentName == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(activity, parentName);
    try {
        final String grandparent = NavUtils.getParentActivityName(activity, target);
        final Intent parentIntent = grandparent == null
                ? IntentCompat.makeMainActivity(target)
                : new Intent().setComponent(target);
        return parentIntent;
    } catch (NameNotFoundException e) {
        Log.e(TAG, "getParentActivityIntent: bad parentActivityName '" + parentName +
                "' in manifest");
        return null;
    }
}
 
源代码8 项目: letv   文件: NavUtils.java
public Intent getParentActivityIntent(Activity activity) {
    Intent intent = null;
    String parentName = NavUtils.getParentActivityName(activity);
    if (parentName != null) {
        ComponentName target = new ComponentName(activity, parentName);
        try {
            intent = NavUtils.getParentActivityName(activity, target) == null ? IntentCompat.makeMainActivity(target) : new Intent().setComponent(target);
        } catch (NameNotFoundException e) {
            Log.e(NavUtils.TAG, "getParentActivityIntent: bad parentActivityName '" + parentName + "' in manifest");
        }
    }
    return intent;
}
 
源代码9 项目: letv   文件: NavUtils.java
public static Intent getParentActivityIntent(Context context, Class<?> sourceActivityClass) throws NameNotFoundException {
    String parentActivity = getParentActivityName(context, new ComponentName(context, sourceActivityClass));
    if (parentActivity == null) {
        return null;
    }
    ComponentName target = new ComponentName(context, parentActivity);
    return getParentActivityName(context, target) == null ? IntentCompat.makeMainActivity(target) : new Intent().setComponent(target);
}
 
源代码10 项目: letv   文件: NavUtils.java
public static Intent getParentActivityIntent(Context context, ComponentName componentName) throws NameNotFoundException {
    String parentActivity = getParentActivityName(context, componentName);
    if (parentActivity == null) {
        return null;
    }
    ComponentName target = new ComponentName(componentName.getPackageName(), parentActivity);
    return getParentActivityName(context, target) == null ? IntentCompat.makeMainActivity(target) : new Intent().setComponent(target);
}
 
源代码11 项目: CodenameOne   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for sourceActivityClass
 * @param sourceActivityClass {@link java.lang.Class} object for an Activity class
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, Class<?> sourceActivityClass)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context,
            new ComponentName(context, sourceActivityClass));
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(context, parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
源代码12 项目: CodenameOne   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for the source activity
 * @param componentName ComponentName for the source Activity
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, ComponentName componentName)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context, componentName);
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(
            componentName.getPackageName(), parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
源代码13 项目: adt-leanback-support   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for sourceActivityClass
 * @param sourceActivityClass {@link java.lang.Class} object for an Activity class
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, Class<?> sourceActivityClass)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context,
            new ComponentName(context, sourceActivityClass));
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(context, parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
源代码14 项目: adt-leanback-support   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for the source activity
 * @param componentName ComponentName for the source Activity
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, ComponentName componentName)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context, componentName);
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(
            componentName.getPackageName(), parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
源代码15 项目: android-recipes-app   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for sourceActivityClass
 * @param sourceActivityClass {@link java.lang.Class} object for an Activity class
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, Class<?> sourceActivityClass)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context,
            new ComponentName(context, sourceActivityClass));
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(context, parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
源代码16 项目: android-recipes-app   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for the source activity
 * @param componentName ComponentName for the source Activity
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, ComponentName componentName)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context, componentName);
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(
            componentName.getPackageName(), parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
源代码17 项目: V.FlyoutTest   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for sourceActivityClass
 * @param sourceActivityClass {@link java.lang.Class} object for an Activity class
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, Class<?> sourceActivityClass)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context,
            new ComponentName(context, sourceActivityClass));
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(context, parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
源代码18 项目: V.FlyoutTest   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for the source activity
 * @param componentName ComponentName for the source Activity
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, ComponentName componentName)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context, componentName);
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(
            componentName.getPackageName(), parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
源代码19 项目: guideshow   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for sourceActivityClass
 * @param sourceActivityClass {@link java.lang.Class} object for an Activity class
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, Class<?> sourceActivityClass)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context,
            new ComponentName(context, sourceActivityClass));
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(context, parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}
 
源代码20 项目: guideshow   文件: NavUtils.java
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} &lt;meta-data&gt;
 * element in the application's manifest.
 *
 * @param context Context for looking up the activity component for the source activity
 * @param componentName ComponentName for the source Activity
 * @return a new Intent targeting the defined parent activity of sourceActivity
 * @throws NameNotFoundException if the ComponentName for sourceActivityClass is invalid
 */
public static Intent getParentActivityIntent(Context context, ComponentName componentName)
        throws NameNotFoundException {
    String parentActivity = getParentActivityName(context, componentName);
    if (parentActivity == null) return null;

    // If the parent itself has no parent, generate a main activity intent.
    final ComponentName target = new ComponentName(
            componentName.getPackageName(), parentActivity);
    final String grandparent = getParentActivityName(context, target);
    final Intent parentIntent = grandparent == null
            ? IntentCompat.makeMainActivity(target)
            : new Intent().setComponent(target);
    return parentIntent;
}