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 startCall(Context context, String uri) {
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(uri));/*from   w  w w .ja v a  2  s.  c  o m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void openUrl(Context pContext, String pUrl) {
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(pUrl));
    pContext.startActivity(browserIntent);
}

From source file:Main.java

public static void openEmail(Context context, String email) {
    Intent data = new Intent(Intent.ACTION_SENDTO);
    data.setData(Uri.parse(email));/*from   ww w.  ja  v  a2 s  .co m*/
    context.startActivity(data);
}

From source file:Main.java

public static void startActivity(Context context, Class<? extends Activity> clazz) {
    Intent intent = new Intent();
    intent.setClass(context, clazz);/*from   w  w w .j  av  a 2 s.co m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void openMap(Context context, String uri) {
    Uri mUri = Uri.parse(uri);//from w w  w .  j av  a 2 s  . c o m
    Intent mIntent = new Intent(Intent.ACTION_VIEW, mUri);
    context.startActivity(mIntent);
}

From source file:Main.java

public static void makeCall(Context context, String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel://" + phoneNumber));
    context.startActivity(intent);
}

From source file:Main.java

public static void jumpHome(Context context) {
    Intent startMain = new Intent(Intent.ACTION_MAIN);
    startMain.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(startMain);
}

From source file:Main.java

public static void startActivityForBundleData(Context act, Class<?> cls, Bundle bundle) {
    Intent intent = new Intent(act, cls);
    intent.putExtras(bundle);//w w  w .  j  ava 2 s  . c  om
    act.startActivity(intent);
}

From source file:Main.java

public static void openDail(Context getContext) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getContext.startActivity(intent);
}

From source file:Main.java

public static void openLink(Context context, String url) {
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    i.setData(Uri.parse(url));//from   w  w  w  .  j a  v a2  s  . c  o  m
    context.startActivity(i);
}