Example usage for android.app Activity startActivity

List of usage examples for android.app Activity startActivity

Introduction

In this page you can find the example usage for android.app Activity startActivity.

Prototype

@Override
public void startActivity(Intent intent) 

Source Link

Document

Same as #startActivity(Intent,Bundle) with no options specified.

Usage

From source file:com.dwdesign.tweetings.util.Utils.java

public static void openUserListTimeline(final Activity activity, final long account_id, final int list_id,
        final long user_id, final String screen_name, final String list_name) {
    if (activity == null)
        return;/*ww w. j  av  a 2 s  .c om*/
    if (activity instanceof DualPaneActivity && ((DualPaneActivity) activity).isDualPaneMode()) {
        final DualPaneActivity dual_pane_activity = (DualPaneActivity) activity;
        final Fragment fragment = new UserListTimelineFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
        args.putInt(INTENT_KEY_LIST_ID, list_id);
        args.putLong(INTENT_KEY_USER_ID, user_id);
        args.putString(INTENT_KEY_SCREEN_NAME, screen_name);
        args.putString(INTENT_KEY_LIST_NAME, list_name);
        fragment.setArguments(args);
        dual_pane_activity.showAtPane(DualPaneActivity.PANE_LEFT, fragment, true);
    } else {
        final Uri.Builder builder = new Uri.Builder();
        builder.scheme(SCHEME_TWEETINGS);
        builder.authority(AUTHORITY_LIST_TIMELINE);
        builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
        if (list_id > 0) {
            builder.appendQueryParameter(QUERY_PARAM_LIST_ID, String.valueOf(list_id));
        }
        if (user_id > 0) {
            builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user_id));
        }
        if (screen_name != null) {
            builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
        }
        if (list_name != null) {
            builder.appendQueryParameter(QUERY_PARAM_LIST_NAME, list_name);
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }
}

From source file:com.dwdesign.tweetings.util.Utils.java

public static void openUserListSubscribers(final Activity activity, final long account_id, final int list_id,
        final long user_id, final String screen_name, final String list_name) {
    if (activity == null)
        return;//from  w  w w . j a  va  2  s.  com
    if (activity instanceof DualPaneActivity && ((DualPaneActivity) activity).isDualPaneMode()) {
        final DualPaneActivity dual_pane_activity = (DualPaneActivity) activity;
        final Fragment fragment = new UserListSubscribersFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
        args.putInt(INTENT_KEY_LIST_ID, list_id);
        args.putLong(INTENT_KEY_USER_ID, user_id);
        args.putString(INTENT_KEY_SCREEN_NAME, screen_name);
        args.putString(INTENT_KEY_LIST_NAME, list_name);
        fragment.setArguments(args);
        dual_pane_activity.showAtPane(DualPaneActivity.PANE_LEFT, fragment, true);
    } else {
        final Uri.Builder builder = new Uri.Builder();
        builder.scheme(SCHEME_TWEETINGS);
        builder.authority(AUTHORITY_LIST_SUBSCRIBERS);
        builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
        if (list_id > 0) {
            builder.appendQueryParameter(QUERY_PARAM_LIST_ID, String.valueOf(list_id));
        }
        if (user_id > 0) {
            builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user_id));
        }
        if (screen_name != null) {
            builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
        }
        if (list_name != null) {
            builder.appendQueryParameter(QUERY_PARAM_LIST_NAME, list_name);
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }
}

From source file:org.getlantern.firetweet.util.Utils.java

public static void openStatusReplies(final Activity activity, final long accountId, final long statusId,
        final String screenName) {
    if (activity == null)
        return;//from ww  w  .  java 2  s . c om
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_STATUS_REPLIES);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId));
    builder.appendQueryParameter(QUERY_PARAM_STATUS_ID, String.valueOf(statusId));
    builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screenName);
    final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
    activity.startActivity(intent);
}

From source file:org.getlantern.firetweet.util.Utils.java

public static void openUserLists(final Activity activity, final long account_id, final long user_id,
        final String screen_name) {
    if (activity == null)
        return;/*from w w w.j a va  2  s  . c o m*/
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_USER_LISTS);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
    if (user_id > 0) {
        builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user_id));
    }
    if (screen_name != null) {
        builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
    }
    final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
    activity.startActivity(intent);
}

From source file:org.getlantern.firetweet.util.Utils.java

public static void openUserFriends(final Activity activity, final long account_id, final long user_id,
        final String screen_name) {
    if (activity == null)
        return;/*from   w  w w  . ja v  a 2  s.  c  o m*/
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_USER_FRIENDS);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
    if (user_id > 0) {
        builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user_id));
    }
    if (screen_name != null) {
        builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
    }
    final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
    activity.startActivity(intent);

}

From source file:org.getlantern.firetweet.util.Utils.java

public static void openUserTimeline(final Activity activity, final long account_id, final long user_id,
        final String screen_name) {
    if (activity == null)
        return;/* w w w . j  a v  a 2 s  . c om*/
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_USER_TIMELINE);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
    if (user_id > 0) {
        builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user_id));
    }
    if (screen_name != null) {
        builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
    }
    final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
    activity.startActivity(intent);
}

From source file:org.getlantern.firetweet.util.Utils.java

public static void openUserFollowers(final Activity activity, final long account_id, final long user_id,
        final String screen_name) {
    if (activity == null)
        return;//from  w  w  w  . j a v a2 s  .  com
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_USER_FOLLOWERS);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
    if (user_id > 0) {
        builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user_id));
    }
    if (screen_name != null) {
        builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
    }
    final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
    activity.startActivity(intent);
}

From source file:org.getlantern.firetweet.util.Utils.java

public static void openUserFavorites(final Activity activity, final long account_id, final long user_id,
        final String screen_name) {
    if (activity == null)
        return;//from  www .j  ava2 s.co m
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_USER_FAVORITES);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
    if (user_id > 0) {
        builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user_id));
    }
    if (screen_name != null) {
        builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
    }
    final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
    activity.startActivity(intent);

}

From source file:org.getlantern.firetweet.util.Utils.java

public static void openUserMediaTimeline(final Activity activity, final long account_id, final long user_id,
        final String screen_name) {
    if (activity == null)
        return;/* w w  w  .ja  va2 s .  co m*/
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_USER_MEDIA_TIMELINE);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
    if (user_id > 0) {
        builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user_id));
    }
    if (screen_name != null) {
        builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
    }
    final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
    activity.startActivity(intent);
}

From source file:cgeo.geocaching.cgBase.java

public static boolean runNavigation(Activity activity, Resources res, cgSettings settings,
        final Geopoint coords, final Geopoint coordsNow) {
    if (activity == null) {
        return false;
    }/*from   w  ww .j a  v  a 2 s  .com*/
    if (settings == null) {
        return false;
    }

    // Google Navigation
    if (settings.useGNavigation == 1) {
        try {
            activity.startActivity(new Intent(Intent.ACTION_VIEW,
                    Uri.parse("google.navigation:ll=" + coords.getLatitude() + "," + coords.getLongitude())));

            return true;
        } catch (Exception e) {
            // nothing
        }
    }

    // Google Maps Directions
    try {
        if (coordsNow != null) {
            activity.startActivity(new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://maps.google.com/maps?f=d&saddr=" + coordsNow.getLatitude() + ","
                            + coordsNow.getLongitude() + "&daddr=" + coords.getLatitude() + ","
                            + coords.getLongitude())));
        } else {
            activity.startActivity(
                    new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?f=d&daddr="
                            + coords.getLatitude() + "," + coords.getLongitude())));
        }

        return true;
    } catch (Exception e) {
        // nothing
    }

    Log.i(cgSettings.tag, "cgBase.runNavigation: No navigation application available.");

    if (res != null) {
        ActivityMixin.showToast(activity, res.getString(R.string.err_navigation_no));
    }

    return false;
}