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 startIntentWithoutHistory(Activity activity, Class intentClass) {
    Intent intent = new Intent(activity, intentClass);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    activity.startActivity(intent);/*  w ww. j  av  a2 s .  c o m*/
}

From source file:Main.java

public static void startActivityForResult(Activity context, Class<?> cls, int requestCode) {
    Intent intent = new Intent(context, cls);
    context.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void CallPhone(Context context, String phone) {
    Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phone));
    context.startActivity(intent);//from  w  w w  .j  a v  a 2 s. c  o  m
}

From source file:Main.java

public static Intent call(String paramString) {
    Uri localUri = Uri.parse("tel:" + paramString);
    return new Intent(Intent.ACTION_CALL, localUri);
}

From source file:Main.java

public static void openBroswer(Context context, String url) {
    Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    //        it.setClassName("com.android.browser", "com.android.browser.BrowserActivity");  
    context.startActivity(it);/* ww w . j a  v  a 2 s .  co  m*/
}

From source file:Main.java

public static void pickImage(Activity activity, int requestCode) throws Exception {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
    intent.setType("image/*");
    // intent.putExtra("return-data", true);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void startActivityForResult(Activity activity, Class<?> cls, int resultCode) {
    Intent intent = new Intent(activity, cls);
    activity.startActivityForResult(intent, resultCode);
}

From source file:Main.java

public static Intent buildIntentWithAction(Context context, Class clazz, String action) {
    Intent intent = new Intent(context, clazz);
    intent.setAction(action);/* w w  w  .  j a va  2s.co  m*/
    return intent;
}

From source file:Main.java

public static void startActivity(Activity activity, Class<? extends Activity> clazz) {
    activity.startActivity(new Intent(activity, clazz));
}

From source file:Main.java

public static void startByFade(Activity context, Class<?> clazz) {
    context.startActivity(new Intent(context, clazz));
    context.overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}