List of usage examples for android.content Intent setData
public @NonNull Intent setData(@Nullable Uri data)
From source file:com.gsoc.ijosa.liquidgalaxycontroller.PW.Utils.java
public static Intent createNavigateToUrlIntent(PwsResult pwsResult) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(pwsResult.getSiteUrl())); return intent; }
From source file:Main.java
public static void openGPS(Context context) { Intent GPSIntent = new Intent(); GPSIntent.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); GPSIntent.addCategory("android.intent.category.ALTERNATIVE"); GPSIntent.setData(Uri.parse("custom:3")); try {/*from w ww . ja va 2s . c o m*/ PendingIntent.getBroadcast(context, 0, GPSIntent, 0).send(); } catch (PendingIntent.CanceledException e) { e.printStackTrace(); } }
From source file:Main.java
public static void installApk(Context context, File apkfile) { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); intent.setType("application/vnd.android.package-archive"); intent.setData(Uri.fromFile(apkfile)); intent.setDataAndType(Uri.fromFile(apkfile), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);/*w w w . j a v a2 s . c om*/ }
From source file:Main.java
public static void email(Context context, String to, String subject, String body) { Intent send = new Intent(Intent.ACTION_SENDTO); String uriText = "mailto:" + Uri.encode(to) + "?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body);//from w w w . jav a 2 s.co m Uri uri = Uri.parse(uriText); send.setData(uri); context.startActivity(Intent.createChooser(send, "E-Mail senden")); }
From source file:Main.java
public static void goToInstalledAppDetails(Context context, String packageName) { Intent intent = new Intent(); int sdkVersion = Build.VERSION.SDK_INT; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.fromParts("package", packageName, null)); } else {/*from ww w . j av a 2 s. c om*/ intent.setAction(Intent.ACTION_VIEW); intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails"); intent.putExtra( (sdkVersion == Build.VERSION_CODES.FROYO ? "pkg" : "com.android.settings.ApplicationPkgName"), packageName); } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void notifyFileSystemChanged(String path, Context mContext) { if (path == null) return;//w ww.j a v a 2s.c om final File f = new File(path); final Intent intent; if (f.isDirectory()) { intent = new Intent(Intent.ACTION_MEDIA_MOUNTED); intent.setClassName("com.android.providers.media", "com.android.providers.media.MediaScannerReceiver"); intent.setData(Uri.fromFile(Environment.getExternalStorageDirectory())); } else { intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); intent.setData(Uri.fromFile(new File(path))); } mContext.sendBroadcast(intent); }
From source file:Main.java
public static void startSettingIntent(Context context, Intent intent) { try {//from www. j a v a2s. c o m intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } catch (Exception e) { intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:" + context.getPackageName())); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }
From source file:Main.java
public static void openGPS(Context context) { Log.d(TAG, "openGPS"); LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); if (!locationManager.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER)) { Intent gpsIntent = new Intent(); gpsIntent.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); gpsIntent.addCategory("android.intent.category.ALTERNATIVE"); gpsIntent.setData(Uri.parse("custom:3")); try {/*w ww . java 2 s . c o m*/ PendingIntent.getBroadcast(context, 0, gpsIntent, 0).send(); } catch (CanceledException e) { Log.d(TAG, "openGPS exception:" + e.getMessage()); e.printStackTrace(); } } }
From source file:org.devtcg.five.activity.SourceCheckSettings.java
public static void actionCheckSettings(Activity context, Uri uri, int requestCode) { Intent i = new Intent(context, SourceCheckSettings.class); i.setData(uri); context.startActivityForResult(i, requestCode); }
From source file:com.geotrackin.gpslogger.senders.osm.OSMHelper.java
public static Intent GetOsmSettingsIntent(Context ctx) { Intent intentOsm; intentOsm = new Intent(ctx.getPackageName() + ".OSM_AUTHORIZE"); intentOsm.setData(Uri.parse("gpslogger://authorize")); return intentOsm; }