Example usage for android.app Activity startActivityForResult

List of usage examples for android.app Activity startActivityForResult

Introduction

In this page you can find the example usage for android.app Activity startActivityForResult.

Prototype

public void startActivityForResult(@RequiresPermission Intent intent, int requestCode) 

Source Link

Document

Same as calling #startActivityForResult(Intent,int,Bundle) with no options.

Usage

From source file:Main.java

public static void goPageForResult(Activity context, int requstcode, Class<?> gopage, String extraName,
        Parcelable extraValue) {/* www . j a  va2  s  . com*/
    Intent intent = new Intent(context, gopage);
    intent.putExtra(extraName, extraValue);
    context.startActivityForResult(intent, requstcode);
}

From source file:Main.java

public static void jumpForResult(Activity sourceActivity, Class<?> targetActivity, int requestCode,
        Bundle bdl) {//  w  w w .  j  a  v a  2 s  .  c  o  m
    Intent intent = new Intent(sourceActivity, targetActivity);
    if (bdl != null) {
        intent.putExtras(bdl);
    }
    sourceActivity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void uninstallApp(String packageName, Activity activity) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.DELETE");
    intent.addCategory("android.intent.category.DEFAULT");
    intent.setData(Uri.parse("package:" + packageName));
    activity.startActivityForResult(intent, 0);
}

From source file:eu.geopaparazzi.library.sketch.SketchUtilities.java

/**
 * Launch intend for result./*  www .j  av a  2s . c  o m*/
 *
 * @param activity    the parent activiuty.
 * @param image       the image to use.
 * @param gpsLocation the position.
 * @param requestCode the return code.
 */
public static void launchForResult(Activity activity, File image, double[] gpsLocation, int requestCode) {
    Intent sketchIntent = prepareIntent(activity, image, gpsLocation);
    activity.startActivityForResult(sketchIntent, requestCode);
}

From source file:de.vanita5.twittnuker.util.SwipebackActivityUtils.java

public static void startSwipebackActivity(final Activity activity, final Intent intent) {
    setActivityScreenshot(activity, intent);
    activity.startActivityForResult(intent, REQUEST_SWIPEBACK_ACTIVITY);
}

From source file:com.pixby.texo.images.ImageUtil.java

public static void getImageFromGallery(Activity activity) {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    activity.startActivityForResult(Intent.createChooser(intent, "Choose Photo"), ImageUtil.PICK_IMAGE_REQUEST);
}

From source file:Main.java

public static void openSettings(Activity context, String action) {
    Intent intent = new Intent();
    ComponentName comp = new ComponentName("com.android.settings", action);
    intent.setComponent(comp);//from w ww .j a  va 2  s  .c  o m
    intent.setAction("android.intent.action.VIEW");
    context.startActivityForResult(intent, 0);
}

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);/*from   ww w .  ja v  a 2  s.c  o  m*/
    intent.setAction("android.intent.action.VIEW");
    activity.startActivityForResult(intent, 0);
}

From source file:Main.java

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

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  . j ava2 s. c  o  m
    intent.setAction("android.intent.action.VIEW");
    activity.startActivityForResult(intent, 0);
}