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

/**
 * Enables bluetooth function.<br />
 * the Activity may implement the `onActivityResult` method with the request code `REQUEST_CODE_BLUETOOTH_ENABLE`.
 *
 * @param activity the activity/*from   ww  w  .  j a v a 2s  . com*/
 */
public static void enableBluetooth(@NonNull Activity activity) {
    activity.startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE),
            REQUEST_CODE_BLUETOOTH_ENABLE);
}

From source file:Main.java

public static void startActivityForResult(Activity activity, Class clazz, int requestCode) {
    activity.startActivityForResult(new Intent(activity, clazz), requestCode);
}

From source file:Main.java

public static void enterActivity(Activity activity, Intent intent, int requestCode) {
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

/**
 * start for result/*  w ww .ja  v  a 2s  .com*/
 * */
public static void startResult(@NonNull Activity activity, int requestCode, @NonNull Intent intent) {
    activity.startActivityForResult(intent, requestCode);
}

From source file:com.stfalcon.socialauthhelper.instagram.utils.InstagramUtils.java

public static void openAuthorizationActivity(Activity activity, int requestCode) {
    activity.startActivityForResult(getAuthIntent(activity), requestCode);
}

From source file:Main.java

/**
 * Safely wrapper of {@link Context#startActivityForResult}.
 * //from  ww w. j av  a2 s  . com
 * @param context
 * @param intent
 * 
 * @return True means start success, otherwise false.
 */
public final static boolean startActivityForResultSafely(Activity context, Intent intent, int requestCode) {
    try {
        context.startActivityForResult(intent, requestCode);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}

From source file:Main.java

/**
 * calls the android chooser to select content for attachment applications immediately. Override {@link Activity#onActivityResult()} in your activity to get
 * the result of the chooser and forward it to {@link #startAttachmentActivityFromChooserResult(Intent, Activity, int)} to call for attachment applications.
 * The given <b>requestCode</b> indicates the chooser result.
 * //  ww w .ja va2s .  c  o  m
 * @param activity
 *            Android {@link Activity} {@link Context}
 * @param requestCode
 *            this code will be returned in {@link Activity#onActivityResult()}
 */
public static void startChooserForAttachmentActivity(Activity activity, int requestCode) {
    activity.startActivityForResult(getChooserIntent(), requestCode);
}

From source file:Main.java

public static Intent openActivity(Activity context, Class<?> activity) {
    Intent i = new Intent(context, activity);
    context.startActivityForResult(i, 1);
    return i;//w  w  w  .  j ava2s.c  o  m
}

From source file:Main.java

public static void enterActivityForResult(Activity activity, Class clz, int requestCode) {
    Intent intent = new Intent(activity, clz);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void startActivityForResult(Activity context, Class<?> cls, int requestCode) {
    Intent intent = new Intent(context, cls);
    context.startActivityForResult(intent, requestCode);
}