List of usage examples for android.content Intent Intent
protected Intent(Parcel in)
From source file:Main.java
private static Intent getImageFileIntent(String filePath) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromFile(new File(filePath)); intent.setDataAndType(uri, "image/*"); return intent; }
From source file:Main.java
public static Intent getCaptureIntent(Uri uri) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (uri != null) { intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); }/* w w w. j av a2s.c o m*/ return intent; }
From source file:Main.java
private static Intent makeAlarmIntent(int index, String uuid, String title, String content, int dispatch) { Intent intent = new Intent("com.xiaomi.channel.rouse"); intent.putExtra("index", index); intent.putExtra("uuid", uuid); intent.putExtra("title", title); intent.putExtra("content", content); intent.putExtra("dispatch", dispatch); return intent; }
From source file:Main.java
public static Intent getAudioFileIntent(String param) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("oneshot", 0); intent.putExtra("configchange", 0); Uri uri = Uri.fromFile(new File(param)); intent.setDataAndType(uri, "audio/*"); return intent; }
From source file:Main.java
public static void call(String number, Context context) { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + number)); context.startActivity(intent);/* w w w.ja v a2 s . co m*/ }
From source file:Main.java
public static Intent createLaunchIntent(ComponentName componentName) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setComponent(componentName);// w w w. j av a 2 s . c o m intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); return intent; }
From source file:Main.java
public static void openWeb(Context context, String url) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url));/*from w w w .jav a 2s. c o m*/ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void shareText(Context context, String title, String text) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, title); intent.putExtra(Intent.EXTRA_TEXT, text); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);// Intent.createChooser(intent, title) }
From source file:Main.java
private static Intent getVideoFileIntent(String filePath) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("oneshot", 0); intent.putExtra("configchange", 0); Uri uri = Uri.fromFile(new File(filePath)); intent.setDataAndType(uri, "video/*"); return intent; }
From source file:Main.java
public static void openWifi(Activity context) { context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); }