Example usage for android.content Context startActivity

List of usage examples for android.content Context startActivity

Introduction

In this page you can find the example usage for android.content Context startActivity.

Prototype

public abstract void startActivity(@RequiresPermission Intent intent);

Source Link

Document

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

Usage

From source file:Main.java

public static void searchTingting(Context context, String appName) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://search?q=pub:" + appName + ""));
    context.startActivity(intent);
}

From source file:Main.java

public static void newMessage(Context context) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setType("vnd.android-dir/mms-sms");
    // intent.putExtra("sms_body", "");
    context.startActivity(intent);
}

From source file:Main.java

public static void openSettings(Context context) {
    Intent intent = new Intent(Settings.ACTION_SETTINGS); // Settings.ACTION_WIFI_SETTINGS
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:Main.java

public static boolean backToHome(Context c) {
    Intent i = new Intent(Intent.ACTION_MAIN);

    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.addCategory(Intent.CATEGORY_HOME);

    c.startActivity(i);

    return true;//from ww  w.  ja v a  2  s  .  c  om
}

From source file:Main.java

public static void locationMarket(Context context, String packangeName) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://details?id=" + packangeName));
    context.startActivity(intent);
}

From source file:Main.java

public static void openSupportPage(Context context) {
    Uri supportUri = Uri.parse("https://notisync.uservoice.com");
    Intent intent = new Intent(Intent.ACTION_VIEW, supportUri);
    context.startActivity(intent);
}

From source file:Main.java

public static void gotoActivity(Context ctx, Class<?> c, String key, String value) {
    Intent intent = new Intent(ctx, c);
    intent.putExtra(key, value);/*from w  ww  . jav a  2  s  .  c o m*/
    ctx.startActivity(intent);
}

From source file:Main.java

public static void dialIn(Context context, String number) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel://" + number));
    context.startActivity(intent);
}

From source file:Main.java

public static void startOtherApp(Context context, String packageName) {
    PackageManager pm = context.getPackageManager();
    Intent launcherIntent = pm.getLaunchIntentForPackage(packageName);
    context.startActivity(launcherIntent);
}

From source file:Main.java

/**
 * This method opens the market with adobe reader for downloading.
 * //from www.  jav  a2  s . co m
 * @param context   The context requesting the intent.
 */
public static void getAdobeReader(Context context) {

    Intent marketIntent = new Intent(Intent.ACTION_VIEW);
    marketIntent.setData(Uri.parse("market://details?id=com.adobe.reader"));
    context.startActivity(marketIntent);

}