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 startActivity(Activity callingActivity, Class<?> targetActivity) {
    Intent intent = new Intent(callingActivity, targetActivity);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    callingActivity.startActivity(intent);
}

From source file:Main.java

public static void InvokeActivity(Activity activity, Class class1) {
    Intent intent = new Intent();
    intent.setClass(activity, class1);
    intent.addCategory("android.intent.category.DEFAULT");
    activity.startActivity(intent);
}

From source file:com.samknows.measurement.util.LoginHelper.java

public static void logout(Activity parent) {
    parent.startActivity(new Intent(parent, SamKnowsLogin.class));

    AppSettings.getInstance().clearAll();
    AppSettings.getInstance().setServiceActivated(false);
    CachingStorage.getInstance().dropExecutionQueue();
    CachingStorage.getInstance().dropParamsManager();

    Intent broadcastIntent = new Intent();
    broadcastIntent.setAction(Constants.INTENT_ACTION_LOGOUT);
    parent.sendBroadcast(broadcastIntent);
}

From source file:com.dmitrymalkovich.android.githubanalytics.util.ActivityUtils.java

public static void openSettings(Activity activity) {
    Intent intent = new Intent(activity, SettingsActivity.class);
    activity.startActivity(intent);
}

From source file:Main.java

public static void uninstall(Activity activity, String packageName) {
    Uri packageURI = Uri.parse("package:" + packageName);
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    activity.startActivity(uninstallIntent);
}

From source file:Main.java

public static void call(Activity activity, String packageName) {
    Intent intent = activity.getPackageManager().getLaunchIntentForPackage(packageName);
    if (null != intent) {
        activity.startActivity(intent);
    }/*  w ww .j a v a  2  s. co m*/
}

From source file:Main.java

public static void tell(String s, Activity activity) {
    if (!"".equals(getEmply(s))) {
        Uri uri = Uri.parse("tel:" + s);
        Intent it = new Intent(Intent.ACTION_DIAL, uri);
        activity.startActivity(it);
    }/*from   w  w  w .  jav a 2 s  .  co m*/
}

From source file:Main.java

public static void call(Activity activity, String mobile) {
    try {//  ww  w .j  a  va 2 s.co m
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse("tel:" + mobile));
        activity.startActivity(callIntent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void launch(Activity activity, String package_name) throws Exception {
    Intent intent = activity.getPackageManager().getLaunchIntentForPackage(package_name);
    if (intent != null)
        activity.startActivity(intent);
    else//  www .j av a2  s .c o  m
        throw new Exception("Package Not Found");
}

From source file:Main.java

public static void scoreApp(Activity activity) {
    Uri uri = Uri.parse("market://details?id=" + activity.getPackageName());
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    try {/*from ww  w . j a  v a 2 s . co m*/
        activity.startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}