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() 

Source Link

Document

Create an empty intent.

Usage

From source file:Main.java

public static void downApkFromBrowser(Context context, String strUrl) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");

    Uri uri = Uri.parse(strUrl);/* w  ww. j  a va  2s. c  o m*/
    intent.setData(uri);

    context.startActivity(intent);
}

From source file:Main.java

public static void install(Activity activity, File apk_file) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(apk_file), "application/vnd.android.package-archive");
    activity.startActivity(intent);/* w ww.ja v  a 2  s .  com*/
}

From source file:Main.java

public static void ActivitySkip(Context context, Class<?> toClass) {
    Intent intent = new Intent();
    intent.setClass(context, toClass);/*w  w  w  .  java  2 s . c o  m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void startActivity(Context context, Class<? extends Activity> clazz) {
    Intent intent = new Intent();
    intent.setClass(context, clazz);//w w  w  .j ava 2s .c om
    context.startActivity(intent);
}

From source file:Main.java

public static void sendText(Activity context, String text) {
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    //        sendIntent.putExtra(Intent.EXTRA_TEXT, text);
    //        sendIntent.setType("text/plain");
    context.startActivity(Intent.createChooser(sendIntent, text));
}

From source file:Main.java

public static void jumpToSystemLocPickImageActivity(Activity activity, int requestCode) {
    Intent intent = null;/* w w w. ja  v a2  s  .  com*/
    intent = new Intent();
    intent.setType("image/*");
    intent.setAction("android.intent.action.GET_CONTENT");
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void installBySys(Context context, File f) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(f), "application/vnd.android.package-archive");
    context.startActivity(intent);//  w w  w .j  a v a  2  s  .  c  o  m
}

From source file:Main.java

public static void installApk(Context context, File file) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    context.startActivity(intent);//from w  w  w .  j  av  a  2s .  co  m
}

From source file:Main.java

private static void finishActivity(Activity activity) {
    activity.setResult(Activity.RESULT_OK, new Intent());
    activity.finish();
}

From source file:Main.java

public static Intent returnIntent_WithObject(Activity activity, Bundle bundle) {
    Intent returnIntent = new Intent();
    returnIntent.putExtras(bundle);/*from  www .j  a v  a 2s  . c om*/
    activity.setResult(Activity.RESULT_OK, returnIntent);
    return returnIntent;
}