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 toWIFISettingActivity(Context mContext) {
    Intent wifiSettingsIntent = new Intent(Settings.ACTION_WIFI_SETTINGS);
    mContext.startActivity(wifiSettingsIntent);
}

From source file:Main.java

public static void install(Context context, File file) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from w ww .java  2s  .  co m*/
}

From source file:Main.java

public static void openSetting(Activity activity, int requestCode) {
    Intent intent = new Intent("/");
    ComponentName cm = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings");
    intent.setComponent(cm);//ww  w. j  ava  2  s  . co  m
    intent.setAction(Intent.ACTION_VIEW);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void install(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(new File(url)), "application/vnd.android.package-archive");
    context.startActivity(intent);/*from w ww .  j  a va 2  s  . c o m*/
}

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);//w ww.  jav a2 s. co m
}

From source file:Main.java

public static void enableBluetooth(Activity activity, int requestCode) {
    Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void showGoogleSearchIntent(Context context, String query) {
    Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
    intent.putExtra(SearchManager.QUERY, query); // query contains search string
    context.startActivity(intent);// ww w  . j a  v a2s. com
}

From source file:Main.java

/**
 * get ringtone list/*from w  ww .  ja va  2  s  . c o  m*/
 * @return
 */
public static Intent getRingtoneIntent() {
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALL);

    return intent;
}

From source file:Main.java

public static void choosePicture(Activity activity) {
    Intent openAlbumIntent = new Intent(Intent.ACTION_GET_CONTENT);
    openAlbumIntent.setType("image/*");
    activity.startActivityForResult(openAlbumIntent, CHOOSE_PICTURE);
}

From source file:Main.java

public static void call(Activity activity, String mobile) {
    try {//from   w w w.  java 2  s. c  om
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse("tel:" + mobile));
        activity.startActivity(callIntent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}