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 startSetNetActivity(Activity activity) {
    Intent intent = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS);
    activity.startActivity(intent);/*  w  ww.  j  a  va  2 s . co m*/
}

From source file:Main.java

public static void installApk(Context context, String apkPath) {

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.parse("file://" + apkPath), "application/vnd.android.package-archive");

    context.startActivity(intent);/*from  w w  w.  j  a va 2  s.  com*/
}

From source file:Main.java

public static void forward(Context context, String body) {
    if (body != null) {
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_TEXT, body);
        context.startActivity(intent);/*from  w w  w. ja v a2s . com*/
    }
}

From source file:Main.java

public static void chooseHomeApp(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  w  ww  .  jav  a 2s .  c  o  m*/
}

From source file:Main.java

public static void installApk(Context context, String apkFilePath) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.parse("file://" + apkFilePath), "application/vnd.android.package-archive");
    context.startActivity(intent);//from   w ww.  j  a  v  a2 s  .  co m
}

From source file:Main.java

public static Intent launchEventById(long id) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri.Builder uri = Events.CONTENT_URI.buildUpon();
    uri.appendPath(Long.toString(id));
    intent.setData(uri.build());//from w  ww.  j a v a  2  s. c  om
    return intent;
}

From source file:Main.java

public static void searchTingting(Context context, String appName) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://search?q=pub:" + appName + ""));
    context.startActivity(intent);/*from   w  w w.j a v  a 2s  .  c  o m*/
}

From source file:Main.java

public static void startSetNetActivity(Context activity) {
    Intent intent = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS);
    activity.startActivity(intent);/*from   w w  w  .j a va 2  s  .c  o m*/
}

From source file:Main.java

public static void showMarketPublish(Context context, String publish) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://search?q=pub:" + publish));
    context.startActivity(intent);/*from w w w .  j  ava 2  s.c  o  m*/
}

From source file:Main.java

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