Java Code Examples for android.support.v4.content.IntentCompat#makeMainActivity()

The following examples show how to use android.support.v4.content.IntentCompat#makeMainActivity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NavUtils.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example 2
Source File: NavUtils.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example 3
Source File: NavUtils.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
@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;
    }
}
 
Example 4
Source File: NavUtils.java    From guideshow with MIT License 6 votes vote down vote up
@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;
    }
}
 
Example 5
Source File: NavUtils.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
@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;
    }
}
 
Example 6
Source File: NavUtils.java    From V.FlyoutTest with MIT License 6 votes vote down vote up
@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;
    }
}
 
Example 7
Source File: NavUtils.java    From android-recipes-app with Apache License 2.0 6 votes vote down vote up
@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;
    }
}
 
Example 8
Source File: NavUtils.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} <meta-data>
 * 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;
}
 
Example 9
Source File: NavUtils.java    From guideshow with MIT License 5 votes vote down vote up
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} <meta-data>
 * 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;
}
 
Example 10
Source File: NavUtils.java    From guideshow with MIT License 5 votes vote down vote up
/**
 * Obtain an {@link Intent} that will launch an explicit target activity
 * specified by sourceActivityClass's {@link #PARENT_ACTIVITY} <meta-data>
 * 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;
}
 
Example 11
Source File: NavUtils.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example 12
Source File: NavUtils.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example 13
Source File: NavUtils.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 14
Source File: NavUtils.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 15
Source File: NavUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 16
Source File: NavUtils.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 17
Source File: NavUtils.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 18
Source File: NavUtils.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 19
Source File: NavUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 20
Source File: NavUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
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);
}