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 openUserListSubscriptions(final Activity activity, final long account_id, final long user_id,
        final String screen_name) {
    if (activity == null)
        return;//from   ww  w.  ja  v a  2  s .c  o  m
    if (activity instanceof DualPaneActivity && ((DualPaneActivity) activity).isDualPaneMode()) {
        final DualPaneActivity dual_pane_activity = (DualPaneActivity) activity;
        final Fragment fragment = new UserListSubscriptionsFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
        args.putLong(INTENT_KEY_USER_ID, user_id);
        args.putString(INTENT_KEY_SCREEN_NAME, screen_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_SUBSCRIPTIONS);
        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);
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }
}

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

public static void openUserProfile(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  a2  s  .c o  m
    if (activity instanceof DualPaneActivity && ((DualPaneActivity) activity).isDualPaneMode()) {
        final DualPaneActivity dual_pane_activity = (DualPaneActivity) activity;
        final Fragment fragment = new UserProfileFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
        if (user_id > 0) {
            args.putLong(INTENT_KEY_USER_ID, user_id);
        }
        if (screen_name != null) {
            args.putString(INTENT_KEY_SCREEN_NAME, screen_name);
        }
        fragment.setArguments(args);
        dual_pane_activity.showAtPane(DualPaneActivity.PANE_RIGHT, fragment, true);
    } else {
        final Uri.Builder builder = new Uri.Builder();
        builder.scheme(SCHEME_TWEETINGS);
        builder.authority(AUTHORITY_USER);
        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);
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }
}

From source file:com.dwdesign.tweetings.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 .  j a va2  s  . c  om*/
    if (activity instanceof DualPaneActivity && ((DualPaneActivity) activity).isDualPaneMode()) {
        final DualPaneActivity dual_pane_activity = (DualPaneActivity) activity;
        final Fragment fragment = new UserFriendsFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
        if (user_id > 0) {
            args.putLong(INTENT_KEY_USER_ID, user_id);
        }
        if (screen_name != null) {
            args.putString(INTENT_KEY_SCREEN_NAME, screen_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_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);
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }

}

From source file:com.dwdesign.tweetings.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;// ww w  . ja v  a  2s  .  c  o  m
    if (activity instanceof DualPaneActivity && ((DualPaneActivity) activity).isDualPaneMode()) {
        final DualPaneActivity dual_pane_activity = (DualPaneActivity) activity;
        final Fragment fragment = new UserTimelineFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
        if (user_id > 0) {
            args.putLong(INTENT_KEY_USER_ID, user_id);
        }
        if (screen_name != null) {
            args.putString(INTENT_KEY_SCREEN_NAME, screen_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_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);
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }

}

From source file:com.dwdesign.tweetings.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;//  w  w w . j  av a2 s . com
    if (activity instanceof DualPaneActivity && ((DualPaneActivity) activity).isDualPaneMode()) {
        final DualPaneActivity dual_pane_activity = (DualPaneActivity) activity;
        final Fragment fragment = new UserFavoritesFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
        if (user_id > 0) {
            args.putLong(INTENT_KEY_USER_ID, user_id);
        }
        if (screen_name != null) {
            args.putString(INTENT_KEY_SCREEN_NAME, screen_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_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);
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }

}

From source file:com.dwdesign.tweetings.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;/* ww  w  .j av a 2 s  . c  o m*/
    if (activity instanceof DualPaneActivity && ((DualPaneActivity) activity).isDualPaneMode()) {
        final DualPaneActivity dual_pane_activity = (DualPaneActivity) activity;
        final Fragment fragment = new UserFollowersFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
        if (user_id > 0) {
            args.putLong(INTENT_KEY_USER_ID, user_id);
        }
        if (screen_name != null) {
            args.putString(INTENT_KEY_SCREEN_NAME, screen_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_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);
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }

}

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

public static void openTweetSearch(final Activity activity, final long account_id, final String query,
        final int search_id) {
    if (activity == null)
        return;//from  www  . ja  va2  s . co m
    if (activity instanceof DualPaneActivity && ((DualPaneActivity) activity).isDualPaneMode()) {
        final DualPaneActivity dual_pane_activity = (DualPaneActivity) activity;
        final Fragment fragment = new SearchTweetsFragment();
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, account_id);
        if (query != null) {
            args.putString(INTENT_KEY_QUERY, query);
        }
        if (search_id > 0) {
            args.putInt(INTENT_KEY_ID, search_id);
        }
        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_SEARCH);
        builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
        builder.appendQueryParameter(QUERY_PARAM_TYPE, QUERY_PARAM_VALUE_TWEETS);
        if (query != null) {
            builder.appendQueryParameter(QUERY_PARAM_QUERY, query);
        }
        if (search_id > 0) {
            builder.appendQueryParameter(QUERY_PARAM_ID, String.valueOf(search_id));
        }
        activity.startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }
}

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

public static void openMutesUsers(final Activity activity, final long account_id) {
    if (activity == null)
        return;/*from   www  .jav  a2 s  .com*/
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_MUTES_USERS);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
    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 openUserBlocks(final Activity activity, final long account_id) {
    if (activity == null)
        return;//from  ww w .  jav  a 2  s . c  om
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_USER_BLOCKS);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
    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 openSavedSearches(final Activity activity, final long account_id) {
    if (activity == null)
        return;/*from   w  ww.j  a  va  2 s.c  o  m*/
    final Uri.Builder builder = new Uri.Builder();
    builder.scheme(SCHEME_FIRETWEET);
    builder.authority(AUTHORITY_SAVED_SEARCHES);
    builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(account_id));
    final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
    activity.startActivity(intent);
}