List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
/** * Minimizes the app/*from w ww. j av a2 s . c o m*/ * @param context the context */ public static void minimizeApp(Context context) { Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(startMain); }
From source file:Main.java
public static void openSMS(Context getContext, String smsBody, String tel) { Uri uri = Uri.parse("smsto:" + tel); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", smsBody); getContext.startActivity(it); }
From source file:Main.java
public static void sendMsg(Context context, String sentTo) { Uri smsToUri = Uri.parse("smsto:" + sentTo); Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri); intent.putExtra("sms_body", ""); context.startActivity(intent); }
From source file:Main.java
public static void uninstallApk(Context context, String packageName) { Intent intent = new Intent(Intent.ACTION_DELETE); Uri packageURI = Uri.parse("package:" + packageName); intent.setData(packageURI);//from w w w . j a va 2s. c om context.startActivity(intent); }
From source file:Main.java
public static void openBrowser(Context context, String s) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(s)); intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); context.startActivity(intent); }
From source file:Main.java
public static void openBroswer(Context context, String url) { Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); // it.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); context.startActivity(it); }
From source file:Main.java
public static void startReview(Context context) { Intent intent = new Intent(Intent.ACTION_VIEW, getReviewUri(context)); if (isIntentAvailable(context, intent)) { context.startActivity(intent); setReviewDone(context, true);//from w w w.jav a 2 s. c o m } else { setReviewDone(context, false); Toast.makeText(context, "Network Error", Toast.LENGTH_LONG).show(); } }
From source file:Main.java
public static void jumpToSystemCallActivity(Context context, String number) { Intent i = new Intent(); i.setAction("android.intent.action.CALL"); i.setData(Uri.parse("tel:" + number)); i.addFlags(268435456);//from ww w.j a va2 s .com context.startActivity(i); }
From source file:Main.java
public static void dial(Context context, String number) { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + number)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
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); }