List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
public static void callByPhone(Context context, String phone) { if (TextUtils.isEmpty(phone)) { return;/*from w w w. ja va 2 s .co m*/ } Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phone)); context.startActivity(intent); }
From source file:Main.java
public static void install(Context context, String mUrl) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(mUrl)), "application/vnd.android.package-archive"); context.startActivity(intent); }
From source file:Main.java
public static void openDeveloperPageOnGooglePlay(Context context, String pubName) { try {//w w w.ja va 2 s. co m Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://search?q=pub:" + pubName)); context.startActivity(intent); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static boolean playAudio(Context context, String mrl, String name) { try {/*from w w w . ja va 2s . co m*/ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(mrl), "audio/*"); context.startActivity(intent); return true; } catch (android.content.ActivityNotFoundException ex) { } return false; }
From source file:Main.java
/** * Opens market detail application page for donate app * //from w ww . j a va 2s. c o m * @param context application context */ public static void gotoDonate(Context context) { Intent marketIntent = new Intent(Intent.ACTION_VIEW); marketIntent.setData(Uri.parse("market://details?id=ru.neverdark.phototoolsdonate")); context.startActivity(marketIntent); }
From source file:Main.java
public static void playMedia(Context ctx, String link, String mime) { Uri path = Uri.parse(link);/* www.ja v a2s . c o m*/ Intent intent = new Intent(Intent.ACTION_VIEW, path); intent.setDataAndType(path, "video/" + mime); ctx.startActivity(intent); }
From source file:Main.java
public static void showAppInfo(String packageName, Context context) { Intent intent = new Intent(); intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.setData(Uri.parse("package:" + packageName)); context.startActivity(intent); }
From source file:Main.java
public static void jumpToHomeActivity(Context context) { Intent mHomeIntent = new Intent("android.intent.action.MAIN"); mHomeIntent.addCategory("android.intent.category.HOME"); mHomeIntent.addFlags(270532608);// w ww. j a v a 2 s . co m context.startActivity(mHomeIntent); }
From source file:Main.java
/** * use for oepn any url in browser./*from w ww . ja v a 2 s . c o m*/ * * @param mContext * @param url to open in your mobile browser */ public static void openURL(Context mContext, String url) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); }
From source file:Main.java
public static void sendTo(Context ctx, String sendWhat) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, sendWhat); ctx.startActivity(shareIntent); }