List of usage examples for android.app Fragment startActivityForResult
public void startActivityForResult(Intent intent, int requestCode)
From source file:org.alfresco.mobile.android.platform.intent.BaseActionUtils.java
/** * Allow to pick file with other apps./*from w w w . j a va 2 s . c o m*/ * * @return Activity for Result. */ public static void actionPickFile(Fragment f, int requestCode) { Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.setType("*/*"); i.addCategory(Intent.CATEGORY_OPENABLE); f.startActivityForResult(Intent.createChooser(i, f.getText(R.string.content_app_pick_file)), requestCode); }
From source file:Main.java
@SuppressLint("NewApi") public static void sendSchemeForResult(Fragment activity, String url, int requestCode, Bundle bundle, int flag) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url)); if (bundle != null) { intent.putExtras(bundle);//from www . j a va 2 s . co m } if (flag != 0) { intent.setFlags(flag); } activity.startActivityForResult(intent, requestCode); }
From source file:org.alfresco.mobile.android.platform.intent.BaseActionUtils.java
/** * Allow to open a file with an associated application installed in the * device and saved it backed via a requestcode... * /*w ww .j a va 2s . c o m*/ * @param myFile * @param mimeType */ public static void openIn(Fragment fr, File myFile, String mimeType, int requestCode) { Intent intent = new Intent(Intent.ACTION_VIEW); Uri data = Uri.fromFile(myFile); intent.setDataAndType(data, mimeType.toLowerCase()); try { fr.startActivityForResult(intent, requestCode); } catch (ActivityNotFoundException e) { AlfrescoNotificationManager.getInstance(fr.getActivity()).showAlertCrouton(fr.getActivity(), R.string.error_unable_open_file); } }
From source file:Main.java
@SuppressLint("NewApi") public static void sendSchemeForResultAddMediaStack(Fragment activity, String mediaActivityUrl, String url, int requestCode, Bundle bundle) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(mediaActivityUrl)); intent.putExtra(TARGET_SCHEME_URI, url); if (bundle != null) { intent.putExtras(bundle);/* w w w .j av a 2 s. c o m*/ } activity.startActivityForResult(intent, requestCode); }
From source file:com.android.contacts.util.AccountFilterUtil.java
/** * Launches account filter setting Activity using * {@link Fragment#startActivityForResult(Intent, int)}. * * @param requestCode requestCode for {@link Activity#startActivityForResult(Intent, int)} * @param currentFilter currently-selected filter, so that it can be displayed as activated. *///from w w w .j ava 2 s . c o m public static void startAccountFilterActivityForResult(Fragment fragment, int requestCode, ContactListFilter currentFilter) { final Activity activity = fragment.getActivity(); if (activity != null) { final Intent intent = new Intent(activity, AccountFilterActivity.class); fragment.startActivityForResult(intent, requestCode); } else { Log.w(TAG, "getActivity() returned null. Ignored"); } }
From source file:com.cyanogenmod.account.util.CMAccountUtils.java
public static void launchWifiSetup(Fragment fragment) { final Context context = fragment.getActivity(); CMAccountUtils.tryEnablingWifi(context); Intent intent = getWifiSetupIntent(context); fragment.startActivityForResult(intent, CMAccount.REQUEST_CODE_SETUP_WIFI); }
From source file:com.phonemetra.account.util.AccountUtils.java
public static void launchWifiSetup(Fragment fragment) { final Context context = fragment.getActivity(); AccountUtils.tryEnablingWifi(context); Intent intent = getWifiSetupIntent(context); fragment.startActivityForResult(intent, Account.REQUEST_CODE_SETUP_WIFI); }
From source file:org.alfresco.mobile.android.application.manager.ActionManager.java
/** * Allow to pick file with other apps.//from w w w. j a va 2s . co m * * @return Activity for Result. */ public static void actionPickFile(Fragment f, int requestCode) { try { Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.setType("*/*"); i.addCategory(Intent.CATEGORY_OPENABLE); f.startActivityForResult(Intent.createChooser(i, f.getText(R.string.content_app_pick_file)), requestCode); } catch (ActivityNotFoundException e) { MessengerManager.showToast(f.getActivity(), R.string.error_unable_open_file); } }
From source file:org.alfresco.mobile.android.application.manager.ActionManager.java
public static boolean actionSendMailWithAttachment(Fragment fr, String subject, String content, Uri attachment, int requestCode) { try {//from w w w .j ava 2 s .c o m Intent i = new Intent(Intent.ACTION_SEND); i.putExtra(Intent.EXTRA_SUBJECT, subject); i.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(content)); i.putExtra(Intent.EXTRA_STREAM, attachment); i.setType("text/plain"); fr.startActivityForResult(Intent.createChooser(i, fr.getString(R.string.send_email)), requestCode); return true; } catch (Exception e) { MessengerManager.showToast(fr.getActivity(), R.string.decryption_failed); Log.d(TAG, Log.getStackTraceString(e)); } return false; }
From source file:com.ez.gallery.ucrop.UCrop.java
/** * Send the crop Intent with a custom request code * * @param fragment Fragment to receive result * @param requestCode requestCode for result *//* w w w .j a v a2 s . c o m*/ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void start(@NonNull Context context, @NonNull Fragment fragment, int requestCode) { fragment.startActivityForResult(getIntent(context), requestCode); }