List of usage examples for android.content Intent Intent
protected Intent(Parcel in)
From source file:Main.java
public static void installAppWithHide(Context context, File file) { Intent intent = new Intent("android.intent.action.VIEW.HIDE"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent);/*www . jav a 2 s . c o m*/ }
From source file:Main.java
public static void scanPhotos(String filePath, Context context) { Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri uri = Uri.fromFile(new File(filePath)); intent.setData(uri);//w ww.ja v a2 s . c o m context.sendBroadcast(intent); }
From source file:Main.java
public static Intent newEmailIntent(Context context, String address, String subject, String body, String cc) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address }); 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 gotoWeb(Context context, String url) { try {/*from w ww . j av a2s .co m*/ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND); // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static Intent getTakeGalleryIntent(Uri imageUri) { // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); return intent; }
From source file:Main.java
public static void sendIconCountMessage(Context mContext, int num) { Intent i = new Intent("android.intent.action.APPLICATION_MESSAGE_UPDATE"); i.putExtra("android.intent.extra.update_application_component_name", "com.xiaomi.alertsystem/.ui.LogoActivity"); String s = ""; if (num > 0) { if (num > 99) s = "99+"; else/*from ww w . j av a 2s. c o m*/ s = "" + num; i.putExtra("android.intent.extra.update_application_message_text", s); } mContext.sendBroadcast(i); }
From source file:Main.java
public static boolean alarmUp(Context context, String action) { return PendingIntent.getBroadcast(context, 0, new Intent(action), PendingIntent.FLAG_NO_CREATE) != null; }
From source file:Main.java
public static void openGPS(Context context) { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); context.startActivity(intent); }
From source file:Main.java
public static String getHomeLauncherName(Application application) { final Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); final ResolveInfo res = application.getPackageManager().resolveActivity(intent, 0); if (res.activityInfo == null) { return ""; }/*from w ww . j a v a2 s . c o m*/ return res.activityInfo.loadLabel(application.getPackageManager()).toString(); }
From source file:Main.java
public static void makeVisible(Context context, int durationSeconds) { Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, durationSeconds); context.startActivity(discoverableIntent); }