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:com.netease.hearttouch.htimagepicker.core.camera.HTCameraActivity.java

public static void startForResult(Activity activity, Uri outputFile, int requestId) {
    Intent intent = new Intent(activity, HTCameraActivity.class);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFile);
    activity.startActivityForResult(intent, requestId);
}

From source file:com.yanzhenjie.album.Album.java

/**
 * @param activity    ?Activity//  w ww . j  av a 2 s .c  om
 * @param requestCode ?
 * @param limitCount  
 */
public static void startAlbum(Activity activity, int requestCode, int limitCount) {
    Intent intent = new Intent(activity, AlbumActivity.class);
    intent.putExtra(KEY_INPUT_LIMIT_COUNT, limitCount);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

/**
 * Enable the bluetooth adapter./*w w  w  .j a  va 2  s  . c om*/
 */
public static void bluetoothEnable(Activity activity, boolean discoverable, int reqCode) {
    if (discoverable) {
        Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
        discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0);
        activity.startActivityForResult(discoverableIntent, reqCode);
    } else {
        Intent bluetoothIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
        activity.startActivityForResult(bluetoothIntent, reqCode);
    }
}

From source file:com.android.common.util.IntentUtils.java

/**
 * Choose photo, this photo data will be returned in onActivityResult()
 *
 * @param activity// w w  w . j  a  v  a  2 s  .co m
 * @param requestCode
 */
public static void choosePhoto(Activity activity, int requestCode) {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    activity.startActivityForResult(intent, requestCode);
}

From source file:com.app.common.util.IntentUtils.java

public static void startActivityForResult(Activity activity, Class<?> cls, Bundle bundle, int requestCode) {
    Intent intent = new Intent();
    intent.setClass(activity, cls);//from  www .j a  v a 2 s  .c o m
    if (null != bundle) {
        intent.putExtras(bundle);
    }

    activity.startActivityForResult(intent, requestCode);
}

From source file:com.bluros.music.utils.NavigationUtils.java

public static void navigateToEqualizer(Activity context) {
    try {//from  w w w.  j  av a  2s .com
        // The google MusicFX apps need to be started using startActivityForResult
        context.startActivityForResult(MusicUtils.createEffectsIntent(), 666);
    } catch (final ActivityNotFoundException notFound) {
        Toast.makeText(context, "Equalizer not found", Toast.LENGTH_SHORT).show();
    }
}

From source file:com.techmighty.baseplayer.utils.NavigationUtils.java

public static void navigateToEqualizer(Activity context) {
    try {/*w  ww .j ava 2 s .  c o  m*/
        // The google MusicFX apps need to be started using startActivityForResult
        context.startActivityForResult(BasePlayerUtils.createEffectsIntent(), 666);
    } catch (final ActivityNotFoundException notFound) {
        Toast.makeText(context, "Equalizer not found", Toast.LENGTH_SHORT).show();
    }
}

From source file:com.devalladolid.musictoday.utils.NavigationUtils.java

public static void navigateToEqualizer(Activity context) {
    try {/*from w  w w  .  j  a v  a 2  s .  c  o  m*/
        // The google MusicFX apps need to be started using startActivityForResult
        context.startActivityForResult(TimberUtils.createEffectsIntent(), 666);
    } catch (final ActivityNotFoundException notFound) {
        Toast.makeText(context, "Equalizer not found", Toast.LENGTH_SHORT).show();
    }
}

From source file:com.yanzhenjie.album.util.AlbumUtils.java

/**
 * Start the camera.//from   w  ww. ja v  a  2 s .  c  o m
 *
 * @param activity    activity.
 * @param requestCode code.
 * @param outPath     file path.
 */
public static void startCamera(Activity activity, int requestCode, File outPath) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    Uri uri = getUri(activity, outPath);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    activity.startActivityForResult(intent, requestCode);
}

From source file:org.devtcg.five.activity.SourceCheckSettings.java

public static void actionCheckSettings(Activity context, Uri uri, int requestCode) {
    Intent i = new Intent(context, SourceCheckSettings.class);
    i.setData(uri);//  ww w .  j  a va2s  .co m
    context.startActivityForResult(i, requestCode);
}