Java Code Examples for android.support.v4.app.fragmentactivity#startActivityForResult()

The following examples show how to use android.support.v4.app.fragmentactivity#startActivityForResult() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmulationActivity.java    From citra_android with GNU General Public License v3.0 6 votes vote down vote up
public static void launch(FragmentActivity activity, String path, String title,
        String screenshotPath, int position, View sharedView)
{
  Intent launcher = new Intent(activity, EmulationActivity.class);

  launcher.putExtra(EXTRA_SELECTED_GAME, path);
  launcher.putExtra(EXTRA_SELECTED_TITLE, title);
  launcher.putExtra(EXTRA_SCREEN_PATH, screenshotPath);
  launcher.putExtra(EXTRA_GRID_POSITION, position);

  ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(
          activity,
          sharedView,
          "image_game_screenshot");

  // I believe this warning is a bug. Activities are FragmentActivity from the support lib
  //noinspection RestrictedApi
  activity.startActivityForResult(launcher, MainPresenter.REQUEST_EMULATE_GAME,
          options.toBundle());
}
 
Example 2
Source File: TrimmerActivity.java    From SimpleVideoEdit with Apache License 2.0 5 votes vote down vote up
public static void go(FragmentActivity from, String videoPath){
    if(!TextUtils.isEmpty(videoPath)) {
        Bundle bundle = new Bundle();
        bundle.putString("path", videoPath);
        Intent intent = new Intent(from,TrimmerActivity.class);
        intent.putExtras(bundle);
        from.startActivityForResult(intent,VIDEO_TRIM_REQUEST_CODE);
    }
}
 
Example 3
Source File: VideoSelectActivity.java    From SimpleVideoEdit with Apache License 2.0 5 votes vote down vote up
public static void go(FragmentActivity from, int clipIndex){
    if(clipIndex != -1) {
        Bundle bundle = new Bundle();
        bundle.putInt("index", clipIndex);
        Intent intent = new Intent(from,VideoSelectActivity.class);
        intent.putExtras(bundle);
        from.startActivityForResult(intent,VIDEO_ADD_REQUEST_CODE);
    }
}
 
Example 4
Source File: FileBrowserHelper.java    From citra_android with GNU General Public License v3.0 5 votes vote down vote up
public static void openDirectoryPicker(FragmentActivity activity)
{
  Intent i = new Intent(activity, CustomFilePickerActivity.class);

  i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
  i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
  i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR);
  i.putExtra(FilePickerActivity.EXTRA_START_PATH,
          Environment.getExternalStorageDirectory().getPath());

  activity.startActivityForResult(i, MainPresenter.REQUEST_ADD_DIRECTORY);
}
 
Example 5
Source File: FileBrowserHelper.java    From citra_android with GNU General Public License v3.0 5 votes vote down vote up
public static void openFilePicker(FragmentActivity activity, int requestCode)
{
  Intent i = new Intent(activity, CustomFilePickerActivity.class);

  i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
  i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
  i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);
  i.putExtra(FilePickerActivity.EXTRA_START_PATH,
          Environment.getExternalStorageDirectory().getPath());

  activity.startActivityForResult(i, requestCode);
}
 
Example 6
Source File: CommentUtil.java    From Social with Apache License 2.0 5 votes vote down vote up
public static void startPicChoiceIntent(FragmentActivity activity,int imageview_id) {
      // TODO Auto-generated method stub
      Intent intent = new Intent();
/* 开启Pictures画面Type设定为image */
      intent.setType("image/*");
/* 使用Intent.ACTION_GET_CONTENT这个Action */
      intent.setAction(Intent.ACTION_GET_CONTENT);
/* 取得相片后返回本画面 */
      activity.startActivityForResult(intent, imageview_id);//requestCode
  }
 
Example 7
Source File: CommentUtil.java    From Social with Apache License 2.0 5 votes vote down vote up
public static void startFileChoiceIntent(FragmentActivity activity) {
      // TODO Auto-generated method stub
      Intent intent = new Intent();
/* 开启Pictures画面Type设定为file */
      intent.setType("file/*");
/* 使用Intent.ACTION_GET_CONTENT这个Action */
      intent.setAction(Intent.ACTION_GET_CONTENT);
/* 取得相片后返回本画面 */
      activity.startActivityForResult(intent, 2);
  }
 
Example 8
Source File: MediaAddActivity.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
/***
 * 进入图片界面
 * 
 * @param activity
 * @param PickMode
 */
public static void gotoPicAddForResult(FragmentActivity activity,
		ArrayList<MediaInfo> selectedMediaInfos) {
	Intent intent = new Intent(activity, MediaAddActivity.class);
	intent.putExtra(MediaConstants.MEDIA_REQUEST_DATAS, selectedMediaInfos);
	activity.startActivityForResult(intent,
			MediaConstants.MEDIA_REQUEST_PIC_CODE);
}
 
Example 9
Source File: MediaShowActivity.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
/***
 * 进入图片选择界面
 * 
 * @param activity
 * @param PickMode
 */
public static void gotoPicForResult(FragmentActivity activity,
		int PickMode, int maxPicks, ArrayList<MediaInfo> selectedMediaInfos) {
	Intent intent = new Intent(activity, MediaShowActivity.class);
	intent.putExtra(MediaConstants.MEDIA_PICK_MODE, PickMode);
	intent.putExtra(MediaConstants.MEDIA_REQUEST_DATAS, selectedMediaInfos);
	intent.putExtra(MediaConstants.MEDIA_RESULT_TYPE,
			MediaConstants.TYPE_PIC);
	intent.putExtra(MediaConstants.MEDIA_MAX_MULTIPLE_PICK, maxPicks);
	activity.startActivityForResult(intent,
			MediaConstants.MEDIA_REQUEST_PIC_CODE);
}