List of usage examples for android.content Intent Intent
protected Intent(Parcel in)
From source file:Main.java
public static Intent newEmailIntent(String toAddress, String subject, String body, String cc) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { toAddress }); intent.putExtra(Intent.EXTRA_TEXT, body); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_CC, cc); intent.setType("message/rfc822"); return intent; }
From source file:Main.java
public static void installAPK(Context context, File file) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent);/*from w w w . j av a 2 s . co m*/ }
From source file:Main.java
public static void startMobileDataSettingActivity(Context context) { Intent mIntent = new Intent("/"); ComponentName comp = new ComponentName("com.android.phone", "com.android.phone.Settings"); mIntent.setComponent(comp);/* w w w .j a v a 2 s.c o m*/ mIntent.setAction("android.intent.action.VIEW"); context.startActivity(mIntent); }
From source file:Main.java
public static void Instanll(File file, Context context) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setFlags(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 . jav a 2 s. c o m }
From source file:Main.java
public static void enableDiscoverable(Context context) { Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300); context.startActivity(discoverableIntent); }
From source file:Main.java
public static void installApk(Activity activity, String path) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive"); activity.startActivity(intent);/*from w w w .j a v a 2 s. co m*/ }
From source file:Main.java
public static void installApp(Context context, File apkFile) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); context.startActivity(intent);/* w ww.ja v a 2 s. c o m*/ }
From source file:Main.java
public static void scanDirAsync(Context ctx, String dir) { Intent scanIntent = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_DIR"); scanIntent.setData(Uri.fromFile(new File(dir))); ctx.sendBroadcast(scanIntent);/*from w w w . j a va 2 s . co m*/ }
From source file:Main.java
public static void sendBroadcast(Context context, String action, Bundle bundle) { Intent intent = new Intent(action); if (bundle != null) { intent.putExtras(bundle);//from ww w .j ava 2s. c om } context.sendBroadcast(intent); }
From source file:Main.java
public static void installApk(Context context, String filename) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(filename)), "application/vnd.android.package-archive"); context.startActivity(intent);/*from w w w . j a v a 2 s . com*/ }