本文整理汇总了Java中android.app.Fragment.startActivityForResult方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.startActivityForResult方法的具体用法?Java Fragment.startActivityForResult怎么用?Java Fragment.startActivityForResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Fragment
的用法示例。
在下文中一共展示了Fragment.startActivityForResult方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startReceivingAisFromAntenna
import android.app.Fragment; //导入方法依赖的package包/类
public static boolean startReceivingAisFromAntenna(final Fragment fragment,final int reqCode,final int ppm) {
final String tag="startReceivingAisFromAntenna - ";
Log.d(TAG,tag);
boolean result=false;
final String arguments = "-p " + ppm + " -P "+ NmeaClientService.NMEA_UDP_PORT+" -h " + NmeaClientService.NMEA_UDP_HOST + " -R -x -S 60 -n";
final Intent intent=createOpenDeviceIntent(fragment,arguments);
if (intent!=null){
fragment.startActivityForResult(intent, reqCode);
result=true;
}
return result;
}
示例2: changeRtlSdrPpm
import android.app.Fragment; //导入方法依赖的package包/类
public static boolean changeRtlSdrPpm(final Fragment fragment,final int reqCode,final int ppm) {
final String tag="changeRtlSdrPpm - ";
Log.d(TAG,tag);
boolean result=false;
final Intent intent=createOpenDeviceIntent(fragment,null);
if (intent!=null){
// Request to change PPM instead of (re)starting RTL-SDR
intent.putExtra(OpenDeviceActivity.EXTRA_CHANGE_PPM,ppm);
fragment.startActivityForResult(intent, reqCode);
result=true;
}
return result;
}
示例3: stopReceivingAisFromAntenna
import android.app.Fragment; //导入方法依赖的package包/类
public static boolean stopReceivingAisFromAntenna(final Fragment fragment,final int reqCode){
final String tag="stopReceivingAisFromAntenna - ";
Log.d(TAG,tag);
boolean result=false;
final Intent intent=createOpenDeviceIntent(fragment,null);
if (intent!=null){
intent.putExtra(OpenDeviceActivity.EXTRA_DISCONNECT, Boolean.TRUE);
fragment.startActivityForResult(intent, reqCode);
result=true;
}
return result;
}
示例4: pickImage
import android.app.Fragment; //导入方法依赖的package包/类
/**
* Pick image from a Fragment with a custom request code
*
* @param context Context
* @param fragment Fragment to receive result
* @param requestCode requestCode for result
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void pickImage(Context context, Fragment fragment, int requestCode) {
try {
fragment.startActivityForResult(getImagePicker(), requestCode);
} catch (ActivityNotFoundException e) {
showImagePickerError(context);
}
}
示例5: requestSysCamera
import android.app.Fragment; //导入方法依赖的package包/类
/**
* Fragment调用系统拍照
*
* @param fragment
* @param requestCode
*/
public void requestSysCamera(Fragment fragment, int requestCode) {
requestCamaraPath = getPhotoTmpPath();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(requestCamaraPath)));
fragment.startActivityForResult(intent, requestCode);
}
示例6: addAccount
import android.app.Fragment; //导入方法依赖的package包/类
/**
* Triggers Android's account adding dialog from a fragment.
* @param fragment A fragment
* @param result An intent result code
*/
public void addAccount(Fragment fragment, int result) {
Intent addGoogleAccount = createAddGoogleAccountIntent();
if (addGoogleAccount.resolveActivity(fragment.getActivity().getPackageManager()) != null) {
fragment.startActivityForResult(addGoogleAccount, result);
} else {
onOpenAddGoogleAccountPageFailed(fragment.getActivity(), result);
}
}
示例7: pickImageFromGallery
import android.app.Fragment; //导入方法依赖的package包/类
/**
* Pick image from a Fragment with a custom request code
*
* @param context Context
* @param fragment Fragment to receive result
* @param requestCode requestCode for result
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void pickImageFromGallery(Context context, Fragment fragment, int requestCode) {
try {
fragment.startActivityForResult(getGalleryImagePicker(), requestCode);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
showMessage(context,e.getMessage());
}
}
示例8: startForResult
import android.app.Fragment; //导入方法依赖的package包/类
/**
* same as {@link Fragment#startActivityForResult(Intent, int)}
*/
public void startForResult(Fragment f, int requestCode) {
f.startActivityForResult(getIntent(), requestCode);
}
示例9: start
import android.app.Fragment; //导入方法依赖的package包/类
@TargetApi(11)
public void start(@NonNull Context context, @NonNull Fragment fragment, int requestCode) {
fragment.startActivityForResult(getIntent(context), requestCode);
}
示例10: start
import android.app.Fragment; //导入方法依赖的package包/类
/**
* Send the crop Intent with a custom request code
*
* @param context Context
* @param fragment Fragment to receive result
* @param requestCode requestCode for result
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void start(Context context, Fragment fragment, int requestCode) {
fragment.startActivityForResult(getIntent(context), requestCode);
}
示例11: goFileChooseActivity
import android.app.Fragment; //导入方法依赖的package包/类
/**
* 进入文件选择界面
*
* @param fragment
* @param requestCode
*/
public static void goFileChooseActivity(Fragment fragment, int requestCode) {
Intent intent = new Intent(fragment.getActivity(), FileChooseActivity.class);
fragment.startActivityForResult(intent, requestCode);
}
示例12: requestPhotoPick
import android.app.Fragment; //导入方法依赖的package包/类
/**
* Fragment调用系统相册
*
* @param fragment
* @param requestCode
*/
public void requestPhotoPick(Fragment fragment, int requestCode) {
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
fragment.startActivityForResult(intent, requestCode);
}
示例13: openActivity
import android.app.Fragment; //导入方法依赖的package包/类
/**
* open gallery
*
* @param activity parent activity
* @param requestCode {@link Activity#onActivityResult}
* @param config {@link GalleryConfig}
*/
public static void openActivity(Fragment activity, int requestCode, GalleryConfig config) {
Intent intent = new Intent(activity.getActivity(), GalleryActivity.class);
intent.putExtra(GALLERY_CONFIG, config);
activity.startActivityForResult(intent, requestCode);
}
示例14: start
import android.app.Fragment; //导入方法依赖的package包/类
/**
* Send the crop Intent with a custom request code
*
* @param fragment Fragment to receive result
* @param requestCode requestCode for result
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void start(@NonNull Context context, @NonNull Fragment fragment, int requestCode) {
fragment.startActivityForResult(getIntent(context), requestCode);
}