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 startActivityForResult(Activity activity, Class<?> cls, int resultCode) {
    Intent intent = new Intent(activity, cls);
    activity.startActivityForResult(intent, resultCode);
}

From source file:Main.java

public static void startRequestEnableBluetoothActivityForResult(Activity activity) {
    Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
    activity.startActivityForResult(intent, REQUEST_ENABLE_BT);
}

From source file:Main.java

public static void startActivity(Activity a, Intent intent, int requestCode) {
    if (requestCode >= 0) {
        a.startActivityForResult(intent, requestCode);
    } else {/*from w  w  w. ja  va2 s .c om*/
        a.startActivity(intent);
    }
}

From source file:Main.java

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

From source file:Main.java

public static void openContacts(Activity context, int requestCode) {
    Uri uri = Uri.parse("content://contacts/people");
    context.startActivityForResult(new Intent(Intent.ACTION_PICK, uri), requestCode);
}

From source file:Main.java

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

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

/**
 * Activity Finish Jump for Result//  w w  w .  j a v  a2s . c o  m
 */
public static void gotoActivityForResult(Activity activity, Class<?> actClass, int requestCode) {
    Intent intent = new Intent(activity, actClass);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void chooseFileIntent(Activity activity) {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    activity.startActivityForResult(intent, FILE_PICK);
}

From source file:Main.java

public static void enableBluetooth(Activity activity, int requestCode) {
    Intent intent = new Intent("android.bluetooth.adapter.action.REQUEST_ENABLE");
    activity.startActivityForResult(intent, requestCode);
}