Example usage for android.content Intent Intent

List of usage examples for android.content Intent Intent

Introduction

In this page you can find the example usage for android.content Intent Intent.

Prototype

protected Intent(Parcel in) 

Source Link

Usage

From source file:Main.java

public static void openSettings(Context context) {
    Intent intent = new Intent(Settings.ACTION_SETTINGS); // Settings.ACTION_WIFI_SETTINGS
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from   ww  w . ja  v  a  2 s.  c o m
}

From source file:Main.java

public static void callPhone(String number, Activity act) {
    Intent callIntent = new Intent(Intent.ACTION_CALL);
    callIntent.setData(Uri.parse("tel:" + number));
    act.startActivity(callIntent);//from  w ww .ja va2  s . c  om
}

From source file:Main.java

public static void startInstall(Context context, Uri uri) {
    Intent install = new Intent(Intent.ACTION_VIEW);
    install.setDataAndType(uri, "application/vnd.android.package-archive");
    install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(install);/*from w  ww  . j  a  v  a 2s.co m*/
}

From source file:Main.java

public static void IntentNetWorkSetting(Activity activity) {
    try {/*from   w w  w . ja  v  a 2s . c  om*/
        Intent wifiSettingsIntent = new Intent("android.settings.WIFI_SETTINGS");
        activity.startActivity(wifiSettingsIntent);
    } catch (Exception ignored) {
    }
}

From source file:Main.java

public static void openNet(Activity activity) {
    Intent intent = new Intent("/");
    ComponentName cm = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings");
    intent.setComponent(cm);/*from w w w.  ja  va 2  s .  c om*/
    intent.setAction("android.intent.action.VIEW");
    activity.startActivityForResult(intent, 0);
}

From source file:Main.java

public static void toHome(Context context) {
    Intent i = new Intent(Intent.ACTION_MAIN);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(i);/*from w  w  w  . ja  v a 2 s  . co  m*/
}

From source file:Main.java

public static void openModule(Context context) {
    context.startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS));
}

From source file:Main.java

public static Intent getCameraIntent(Uri saveFileURI) {
    Intent mIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    return mIntent.putExtra(MediaStore.EXTRA_OUTPUT, saveFileURI);
}

From source file:Main.java

public static void installApp(Context context, String path) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.parse("file://" + path), "application/vnd.android.package-archive");
    context.startActivity(intent);//from  w w w  .ja  va  2  s.co  m
}

From source file:Main.java

public static void accessUrl(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setData(Uri.parse(url));/*  w  w  w .j  a  v a  2s .co m*/
    context.startActivity(intent);
}