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 launchActivityForResult(Activity context, Class<?> activity, int requestCode) {
    Intent intent = new Intent(context, activity);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    context.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void pickImageFromPhoto(Activity activity, int requestCode) {

    Intent intent = new Intent(Intent.ACTION_PICK, null);
    intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
    activity.startActivityForResult(intent, requestCode);

}

From source file:Main.java

public static void goToForResult(Activity aty, Class clazz, Bundle bundle, int requestCode) {
    Intent intent = new Intent(aty, clazz);
    if (bundle != null) {
        intent.putExtras(bundle);//from   w w w . j av a  2s  . co m
    }
    aty.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void openActivityForResult(Activity context, Class<?> activity, Bundle b, int requestCode) {
    Intent intent = new Intent(context, activity);
    if (b != null)
        intent.putExtras(b);/*from w  w w  .  j a  v a 2  s. co  m*/
    context.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void openFileBrowser(Activity a, int requestCode) {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("*/*");
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    a.startActivityForResult(intent, requestCode);
}

From source file:net.bither.util.SystemUtil.java

public static void gotoWirelessSetting(Activity activity) {
    if (android.os.Build.VERSION.SDK_INT > 10) {
        activity.startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS),
                BitherSetting.INTENT_REF.WIRELESS_SETTINGS_CODE);
    } else {/*  w w w.j av  a 2  s  . co  m*/
        activity.startActivityForResult(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS),
                BitherSetting.INTENT_REF.WIRELESS_SETTINGS_CODE);
    }
}

From source file:Main.java

public static void jumpToSystemLocPickImageActivity(Activity activity, int requestCode) {
    Intent intent = null;/* w  ww  .  j a  va 2 s. c om*/
    intent = new Intent();
    intent.setType("image/*");
    intent.setAction("android.intent.action.GET_CONTENT");
    activity.startActivityForResult(intent, requestCode);
}

From source file:it.cosenonjaviste.mv2m.ArgumentManager.java

/**
 * @deprecated Use {@link ActivityHolder#startActivityForResult(Class, int, Object)} instead.
 *//*from w  ww  . j a  v  a 2s.  com*/
@Deprecated
public static <ARG, VM extends ViewModel<ARG, ?>, A extends ViewModelActivity<VM>> void startActivityForResult(
        Activity activity, Class<A> cls, int requestCode, ARG argument) {
    if (activity != null) {
        activity.startActivityForResult(createIntent(activity, cls, argument), requestCode);
    }
}

From source file:Main.java

public static void pickImage(Activity activity, int requestCode) throws Exception {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
    intent.setType("image/*");
    // intent.putExtra("return-data", true);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void startDataCheck(Activity callingActivity) {
    Log.d(TAG, "launching speech check");
    Intent checkIntent = new Intent();
    checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
    callingActivity.startActivityForResult(checkIntent, SPEECH_DATA_CHECK_CODE);
}