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:Main.java

public static void downloadGooglePlayServices(Activity activity) {
    Intent marketIntent = new Intent(Intent.ACTION_VIEW,
            Uri.parse("market://details?id=com.google.android.gms"));
    activity.startActivity(marketIntent);
}

From source file:Main.java

public static void startActivity(Activity current, Class<? extends Activity> next) {
    saveActivity(current, next);//  w  ww  . j a va  2s. com
    Intent i = new Intent(current, next);
    current.startActivity(i);
    current.finish();
}

From source file:Main.java

public static void openInBrowser(Activity activity, String link) {
    Intent sharingIntent = new Intent(android.content.Intent.ACTION_VIEW);
    sharingIntent.setData(Uri.parse(link));
    activity.startActivity(sharingIntent);
}

From source file:Main.java

public static void rateTheApp(Activity activity) {
    Intent goToMarket = new Intent(Intent.ACTION_VIEW,
            Uri.parse("market://details?id=" + activity.getPackageName()));
    activity.startActivity(goToMarket);
}

From source file:Main.java

public static void openActivityFromHistory(Activity activity, Class<?> pClass) {
    Intent intent = new Intent(activity, pClass);
    intent.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
    activity.startActivity(intent);
}

From source file:Main.java

public static void jumpTo(Activity activity, String url) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));/*w ww  .j a v  a2  s  .c  o  m*/
    activity.startActivity(intent);
}

From source file:Main.java

public static <T> void jumpActivityNewTask(Activity activity, Class<T> targetActivity) {
    Intent intent = new Intent(activity, targetActivity);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    activity.startActivity(intent);
}

From source file:Main.java

public static void showViewDial(String phoneNumber, Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    activity.startActivity(intent);
}

From source file:Main.java

public static void directDial(String phoneNumber, Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    activity.startActivity(intent);
}

From source file:Main.java

public static void gotoActivity(Activity curActivity, Class<?> targetActivity, boolean finish) {
    Intent intent = new Intent();
    intent.setClass(curActivity, targetActivity);
    curActivity.startActivity(intent);
    //      curActivity.overridePendingTransition(R.anim.slide_left_in,
    //            R.anim.slide_left_out);

    if (finish) {
        curActivity.finish();//from  w  w w. j a v a  2s  .com
    }
}