Example usage for android.content Intent Intent

List of usage examples for android.content Intent Intent

Introduction

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

Prototype

public Intent(Context packageContext, Class<?> cls) 

Source Link

Document

Create an intent for a specific component.

Usage

From source file:Main.java

public static void call(Context context, String phone) {
    Intent callIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phone));
    context.startActivity(callIntent);//from w ww . j  av a2 s .  c o  m
}

From source file:Main.java

public static void dowloadBySystem(Context context, String url) {
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    context.startActivity(i);//w  w w  . j  ava 2  s .c  o m
}

From source file:Main.java

public static void enterActivityForResult(Activity activity, Class clz, int requestCode) {
    Intent intent = new Intent(activity, clz);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void startActivityAndFinishSelf(Activity activity, Class clz) {
    activity.startActivity(new Intent(activity, clz));
    activity.finish();
}

From source file:Main.java

public static void openBrowser(Context context, String s) {
    Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(s));
    intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");
    context.startActivity(intent);//ww  w.  java2s.  co m
}

From source file:Main.java

public static void openURL(Activity activity, String url) {
    Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    activity.startActivity(webIntent);//from   www. j ava2  s .  c  o m
}

From source file:Main.java

public static void start(Context context, Class clazz) {
    Intent intent = new Intent(context, clazz);
    context.startActivity(intent);/* www  . ja  v a  2  s  .c om*/
    ((Activity) context).finish();
}

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 fileScan(Context context, String s) {
    context.sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE",
            Uri.parse((new StringBuilder()).append("file://").append(s).toString())));
}

From source file:Main.java

public static void startActivityAndFinish(Activity packageContext, Class<?> cls) {
    Intent intent = new Intent(packageContext, cls);
    packageContext.startActivity(intent);
    packageContext.finish();/*from   w w  w  .  j av a  2  s .  com*/

}