Java 类android.app.Fragment 实例源码

项目:ChatExchange-old    文件:HueFragmentPagerAdapter.java   
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object)
{
    Fragment fragment = (Fragment) object;
    if (fragment != mCurrentPrimaryItem)
    {
        if (mCurrentPrimaryItem != null)
        {
            mCurrentPrimaryItem.setMenuVisibility(false);
            mCurrentPrimaryItem.setUserVisibleHint(false);
        }
        if (fragment != null)
        {
            fragment.setMenuVisibility(true);
            fragment.setUserVisibleHint(true);
        }
        mCurrentPrimaryItem = fragment;
    }
}
项目:ActivityBuilder    文件:MessengerFragment.java   
public static MessengerFragment fragmentFor(Activity activity) {
  FragmentManager fm = activity.getFragmentManager();
  if (fm.isDestroyed()) {
    throw new IllegalStateException("Activity already destroyed");
  }
  Fragment fragmentByTag = fm.findFragmentByTag(FRAGMENT_TAG);
  if (fragmentByTag != null && !(fragmentByTag instanceof MessengerFragment)) {
    throw new IllegalStateException("Unexpected "
        + "fragment instance was returned by FRAGMENT_TAG");
  }
  MessengerFragment fragment = (MessengerFragment) fragmentByTag;
  if (fragment == null) {
    fragment = new MessengerFragment();
    fm.beginTransaction().add(fragment, FRAGMENT_TAG)
        .commitAllowingStateLoss();
    // 接下来需要立刻通过这个 Fragment 来启动 Activity,所以需要立刻添加到 Activity 中
    fm.executePendingTransactions();
  }
  return fragment;
}
项目:Reer    文件:Main2slideMenu.java   
private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new PlanetFragment();
    Bundle args = new Bundle();
    args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position);
    fragment.setArguments(args);
    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
    // update selected item and title, then close the drawer
    mLeftDrawer.setItemChecked(position, true);
    setTitle(mContent[position]);
    mDlMain.closeDrawer(mLeftDrawer);
}
项目:ShangHanLun    文件:FragmentFactory.java   
public static Fragment getInstanceByIndex(int index) {
    Fragment fragment = null;
    switch (index) {
        case R.id.firstContentTab:
            fragment = new MainFragment();
            break;
        case R.id.fangYaoTab:
            fragment = new FangFragment();
            break;
        case R.id.yaoTab:
            fragment = new YaoFragment();
            break;
        case R.id.unitTab:
            fragment = new UnitFragment();
            break;
        case R.id.settingsTab:
            fragment = new SettingsFragment();
            break;
    }
    return fragment;
}
项目:Bartout    文件:BartourActivity.java   
private void showUserFragment(User user){
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag(USER_FRAGMENT_LABEL);
    if(prev != null){
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    UserFragment newFragment = UserFragment.newInstance(user);
    newFragment.show(ft, USER_FRAGMENT_LABEL);
}
项目:atlas    文件:InstrumentationHook.java   
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    public ActivityResult execStartActivity(final Context who, final IBinder contextThread,
            final IBinder token, final Fragment target, final Intent intent, final int requestCode) {

        return execStartActivityInternal(who, intent,requestCode, new ExecStartActivityCallback() {

            @Override
            public ActivityResult execStartActivity() {
                return ActivityBridge.execStartActivity(intent,new ExecStartActivityCallback(){
                    @Override
                    public ActivityResult execStartActivity(Intent wrapperIntent) {
                        return mBase.execStartActivity(who, contextThread, token, target, intent, requestCode);
                    }
                });
//              return mBase.execStartActivity(who, contextThread, token, target, intent, requestCode);
            }

        });

    }
项目:android-image-classification    文件:MainActivity.java   
public void runCameraLiveView() {
    final Fragment cameraView = CameraConnectionFragment.newInstance(
            new CameraConnectionFragment.ConnectionCallback() {
                @Override
                public void onPreviewSizeChosen(Size size, int rotation) {
                    MainActivity.this.onPreviewSizeChosen(size);
                }
            },
            this,
            R.layout.placerecognizer_ui,
            new Size(mImageClassifier.getImageWidth(), mImageClassifier.getImageHeight())
    );

    getFragmentManager().beginTransaction()
                    .replace(R.id.container, cameraView)
                    .commit();
}
项目:aos-Video    文件:NetworkRootActivity.java   
/**
 * Temp stuff to show the rescan button that is for now hidden (not ready for prime-time)
 * (to remove once re-scan feature is published)
 * @param keyCode
 * @param event
 * @return
 */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode==KeyEvent.KEYCODE_DPAD_UP) {
        keyupCount++;
        if (keyupTrainStartTimeMs==0) {
            keyupTrainStartTimeMs = SystemClock.elapsedRealtime();
        }
        // Check for 5 press in less than 1 second
        if (keyupCount>4 && (SystemClock.elapsedRealtime()-keyupTrainStartTimeMs<1000)) {
            // display re-scan item
            Fragment f = getFragmentManager().findFragmentById(R.id.fragment_container);
            if (f!=null && f instanceof NetworkRootFragment) {
                ((NetworkRootFragment)f).displayRescanItem();
                Toast.makeText(this, "Displaying Re-scan item (caution it is Debug only for now)", Toast.LENGTH_SHORT).show();
            }
        }
    }
    else {
        // reset if another key is pressed
        keyupCount=0;
        keyupTrainStartTimeMs=0;
    }
    return super.onKeyDown(keyCode, event);
}
项目:Quran    文件:AboutUsActivity.java   
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.about_us);

  final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setTitle(R.string.menu_about);
  setSupportActionBar(toolbar);
  final ActionBar ab = getSupportActionBar();
  if (ab != null) {
    ab.setDisplayHomeAsUpEnabled(true);
  }

  final FragmentManager fm = getFragmentManager();
  final Fragment fragment = fm.findFragmentById(R.id.content);
  if (fragment == null) {
    fm.beginTransaction()
        .replace(R.id.content, new AboutFragment())
        .commit();
  }
}
项目:puremadrid    文件:MainActivity.java   
@Override
public void onBackPressed() {
    if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(Gravity.START)) {
        mDrawerLayout.closeDrawer(Gravity.START);
    } else {
        // TODO: To be improved:
        try {
            super.onBackPressed();
        } catch (IllegalStateException e){
            Fragment fragment = getFragmentManager().findFragmentByTag(MainFragment.class.getName());
            if (fragment == null) {
                fragment = new MainFragment();
            }
            if (!fragment.isAdded()) {
                FragmentTransaction transaction = getFragmentManager().beginTransaction();
                transaction.replace(R.id.content_frame, fragment, MainFragment.class.getName());
                transaction.commit();
            }
        }
    }
}
项目:quickhybrid-android    文件:PhotoSelector.java   
/**
 * Fragment调用系统拍照
 *
 * @param fragment
 * @param requestCode
 */
public void requestSysCamera(android.support.v4.app.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);
}
项目:ShangHanLun    文件:SingletonData.java   
public void reReadData(final Activity activity){
    final ProgressBar bar = Helper.showProgressBar(activity);
    new Thread(new Runnable() {
        @Override
        public void run() {
            reReadData();
            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Helper.removeFormWindow(activity, bar);
                    TabController tab = (TabController) activity;
                    for (Fragment frag : tab.fragments) {
                        if (frag instanceof MainFragment) {
                            ((MainFragment) frag).resetData(SingletonData.getInstance().getContent());
                        } else if (frag instanceof FangFragment) {
                            ((FangFragment) frag).resetData(SingletonData.getInstance().getFang());
                        }
                    }
                }
            });

        }
    }).start();
}
项目:iosched-reader    文件:AboutUtils.java   
public static void showEula(Activity activity) {
    FragmentManager fm = activity.getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("dialog_eula");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    new EulaDialog().show(ft, "dialog_eula");
}
项目:AndroidBackendlessChat    文件:ChatSDKIntentClickListener.java   
public static View.OnClickListener getPickImageClickListener(final Activity activity,final Fragment fragment, final int requestCode){
    return new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            pickIntent();
        }

        private void pickIntent(){
            Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);

            activity.startActivityFromFragment(fragment, Intent.createChooser(intent,
                    "Complete action using"), requestCode);
        }
    };
}
项目:shortrain    文件:TutorialViewPagerAdapter.java   
@Override
public Fragment getItem(int position) {
    switch (position) {
        case 0:
            return TutorialFragment.create(R.raw.tutorial_1, R.string.tutorial_1);
        case 1:
            return TutorialFragment.create(R.raw.tutorial_2, R.string.tutorial_2);
        case 2:
            return TutorialFragment.create(R.raw.tutorial_3, R.string.tutorial_3);
        case 3:
            return TutorialFragment.create(R.raw.tutorial_4, R.string.tutorial_4);
        case 4:
            return TutorialFragment.create(R.raw.tutorial_5, R.string.tutorial_5);
    }

    throw new UnsupportedOperationException("Each tutorial page must have its fragment");
}
项目:grid-video-viewer    文件:GalleryActivity.java   
public void changeFragment(String tag) {
    mBackPressListener = null;
    Fragment fragment = null;

    if (FRAGMENT_GRID.equals(tag)) {
        fragment = new VideoGridFragment();
        fragment.setArguments(getIntent().getExtras());
        mBackPressListener = (VideoGridFragment) fragment;
    }

    if (fragment != null) {
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.replace(R.id.container, fragment, tag);
        transaction.commit();
    }
}
项目:Keep-HODLing    文件:MainActivity.java   
@Override
public void onBackPressed() {
    Fragment current = getFragmentManager().findFragmentById(android.R.id.content);

    if (current instanceof SettingsFragment) {
        if (preferences.arePreferencesValid()) {
            getFragmentManager().beginTransaction()
                    .replace(android.R.id.content, new DashboardFragment())
                    .commit();
        } else {
            getFragmentManager().beginTransaction()
                    .replace(android.R.id.content, new ConfigureMeFragment())
                    .commit();
        }
    } else {
        super.onBackPressed();
    }
}
项目:AndroidOpen    文件:MainActivity.java   
protected Fragment getBaseFragment() {
    int fragmentResourceId = getIntent().getIntExtra("fragment_resource_id", R.layout.fragment_thing_list);
    switch (fragmentResourceId) {
        case R.layout.fragment_thing_list:
        default:
            return new ThingListFragment();
        case R.layout.fragment_thing_detail:
            return ThingDetailFragment.create();
        case R.layout.fragment_overaly:
            return new OverlayFragment();
    }
}
项目:WearVibrationCenter    文件:MainActivity.java   
private void switchToFragmentWithBackStack(Fragment fragment)
{
    getFragmentManager()
            .beginTransaction()
            .replace(R.id.content_frame, fragment)
            .addToBackStack(null)
            .commit();

    getFragmentManager().executePendingTransactions();
}
项目:AppChooser    文件:ActivityUtils.java   
public static void remove(@NonNull FragmentManager fm, @NonNull String tag) {
    checkNotNull(fm);
    checkNotNull(tag);

    Fragment prev = fm.findFragmentByTag(tag);
    if (prev != null) {
        fm.beginTransaction().remove(prev).commit();
    }
}
项目:Companion-For-PUBG-Android    文件:DrawerActivity.java   
private void itemsSelected() {
    if (this.contentLayout == null) {
        return;
    }

    final Fragment fragment = getFragmentManager().findFragmentByTag(ItemFragment.TAG);
    if (fragment == null) {
        showFragment(new ItemFragment(), ItemFragment.TAG);
    } else {
        showFragment(fragment, ItemFragment.TAG);
    }
}
项目:chromium-for-android-56-debug-video    文件:ConfirmSyncDataStateMachine.java   
private static void cancelDialog(FragmentManager fragmentManager, String tag) {
    Fragment fragment = fragmentManager.findFragmentByTag(tag);

    if (fragment == null) return;
    DialogFragment dialogFragment = (DialogFragment) fragment;

    if (dialogFragment.getDialog() == null) return;
    dialogFragment.getDialog().cancel();
}
项目:GitHub    文件:MessageDialog.java   
/**
 * Use from Activities.
 *
 * @param icon     dialog icon
 * @param title    dialog title
 * @param message  dialog message
 * @param fragment target fragment
 * @return a new instance of MessageDialog
 */
public static MessageDialog newInstance(int icon, String title, String message, Fragment fragment) {
    MessageDialog confirmDialog = new MessageDialog();
    Bundle args = new Bundle();
    args.putInt(ARG_ICON, icon);
    args.putString(ARG_TITLE, title);
    args.putString(ARG_MESSAGE, message);
    confirmDialog.setArguments(args);
    if (fragment != null) confirmDialog.setTargetFragment(fragment, 0);
    return confirmDialog;
}
项目:Open-Quran-Radio    文件:MainActivity.java   
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_main);
    // hand results over to fragment main
    fragment.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
项目:easyfilemanager    文件:StandaloneActivity.java   
/**
 * Set state sort order based on explicit user action.
 */
private void setUserSortOrder(int sortOrder) {
    mState.userSortOrder = sortOrder;
    Fragment fragment = DirectoryFragment.get(getFragmentManager());
    if(fragment instanceof DirectoryFragment) {
        final DirectoryFragment directory = (DirectoryFragment) fragment;
        directory.onUserSortOrderChanged();
    }
}
项目:tensorflow-classifier-android    文件:CameraActivity.java   
protected void setFragment() {
  String cameraId = chooseCamera();

  Fragment fragment;
  if (useCamera2API) {
    CameraConnectionFragment camera2Fragment =
        CameraConnectionFragment.newInstance(
            new CameraConnectionFragment.ConnectionCallback() {
              @Override
              public void onPreviewSizeChosen(final Size size, final int rotation) {
                previewHeight = size.getHeight();
                previewWidth = size.getWidth();
                CameraActivity.this.onPreviewSizeChosen(size, rotation);
              }
            },
            this,
            getLayoutId(),
            getDesiredPreviewFrameSize());

    camera2Fragment.setCamera(cameraId);
    fragment = camera2Fragment;
  } else {
    fragment =
        new LegacyCameraConnectionFragment(this, getLayoutId(), getDesiredPreviewFrameSize());
  }

  getFragmentManager()
      .beginTransaction()
      .replace(R.id.container, fragment)
      .commit();
}
项目:shortrain    文件:TutorialFragment.java   
public static Fragment create(int movieResId, int textId) {
    TutorialFragment tutorialFragment = new TutorialFragment();
    Bundle bundle = new Bundle();
    bundle.putInt(MOVIE_RES_ID, movieResId);
    bundle.putInt(TEXT_RES_ID, textId);
    tutorialFragment.setArguments(bundle);
    return tutorialFragment;
}
项目:XERUNG    文件:Crop.java   
/**
 * Pick image from a support library Fragment with a custom request code
 *
 * @param context     Context
 * @param fragment    Fragment to receive result
 * @param requestCode requestCode for result
 */
public static void pickImage(Context context, android.support.v4.app.Fragment fragment, int requestCode) {
    try {
        fragment.startActivityForResult(getImagePicker(), requestCode);
    } catch (ActivityNotFoundException e) {
        showImagePickerError(context);
    }
}
项目:Stalker    文件:MainActivity.java   
public void startLocationFragment() {
    fragmentTransaction = fragmentManager.beginTransaction();
    Fragment fragment = new PlaceFragment();
    fragmentTransaction.replace(R.id.welcome_fragment_id, fragment);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commit();
}
项目:LemonKit4Android    文件:LKUIAnnotationParser.java   
/**
 * 透过Fragment解析LKUI注解
 * 可以通过注解配置contentView,field的id等
 */
public static View parse(Fragment fragment, LayoutInflater inflater, ViewGroup container, boolean ignoreNoFindViewField) {
    View rView = null;
    try {
        // 解析类注解:SetContentView
        SetContentView setContentView = fragment.getClass().getAnnotation(SetContentView.class);
        if (setContentView != null && setContentView.value() > 0)
            // 可以读到SetContentView的layout的id值
            rView = inflater.inflate(setContentView.value(), container, false);
        // 解析属性注解:FindView
        Field[] fields = fragment.getClass().getDeclaredFields();
        for (Field fieldItem : fields) {
            fieldItem.setAccessible(true);
            if (!(View.class.isAssignableFrom(fieldItem.getType())))
                continue;
            FindView findView = fieldItem.getAnnotation(FindView.class);
            if (findView != null)
                // 配置了FindView注解
                if (findView.value() > 0)
                    fieldItem.set(fragment, container.findViewById(findView.value()));
                else // 如果没有设置view的id,那么自动尝试以属性名作为id进行查询赋值
                    fieldItem.set(fragment, LKResourceTool.findViewByIdStr(rView, fieldItem.getName()));
            else if (!ignoreNoFindViewField)// 没有配置FindView注解并且没有设置忽略无注解属性(ignoreNoFindViewField为false),尝试以属性名作为id,进行查询赋值
                fieldItem.set(fragment, LKResourceTool.findViewByIdStr(rView, fieldItem.getName()));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return rView == null ? new View(fragment.getActivity()) : rView;
}
项目:BWS-Android    文件:VerificationActivity.java   
private void setupFragment(@NonNull VerificationTokenProvider tokenProvider) {
    Fragment facialRecognitionFragment = getFragmentManager().findFragmentByTag(TAG_FACIAL_RECOGNITION_FRAGMENT);
    if (facialRecognitionFragment == null) {
        // fragment is not retained
        FacialRecognitionFragment fragment = createFragment(tokenProvider);
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.add(R.id.frame_layout, fragment, TAG_FACIAL_RECOGNITION_FRAGMENT);
        transaction.commit();
    }
}
项目:quickhybrid-android    文件:UtilApi.java   
/**
 * 打开二维码
 * <p>
 * 参数:
 * videoUrl:视频地址
 */
public static void scan(IQuickFragment webLoader, WebView wv, JSONObject param, Callback callback) {
    Object fragment = webLoader.getPageControl().getFragment();
    IntentIntegrator integrator = null;
    if (fragment instanceof Fragment) {
        integrator = IntentIntegrator.forFragment((Fragment) fragment);
    } else if (fragment instanceof android.support.v4.app.Fragment) {
        integrator = IntentIntegrator.forSupportFragment((android.support.v4.app.Fragment) fragment);
    }
    if (integrator != null) {
        integrator.setCaptureActivity(ScanCaptureActivity.class);
        integrator.initiateScan();
        webLoader.getWebloaderControl().addPort(AutoCallbackDefined.OnScanCode, callback.getPort());
    }
}
项目:Android_watch_magpie    文件:SubscriberActivity.java   
private void navigate(final int itemId) {
    switch (itemId) {
        case R.id.menuSubItem1:
            Fragment contactsFrag = new ContactsFragment();
            Bundle bundle = new Bundle();
            String key = MobileClient.EXTRA_USER;
            MobileClient value = getIntent().getParcelableExtra(MobileClient.EXTRA_USER);
            bundle.putParcelable(key, value);
            contactsFrag.setArguments(bundle);
            getFragmentManager()
                    .beginTransaction()
                    .remove(contactsFrag)
                    .replace(R.id.subContentFrame, contactsFrag)
                    .commit();
            break;
        case R.id.menuSubItem2:
            getFragmentManager()
                    .beginTransaction()
                    .replace(R.id.subContentFrame, requestSubsFrag)
                    .commit();
            break;
        case R.id.menuSubItem3:
            SessionManager manager = new SessionManager(this);
            manager.logoutUser();
            break;
        default:
            break;
    }
}
项目:Carousel    文件:CarouselView.java   
public CarouselRequestManager with(Fragment fragment) {
    FragmentManager fm = fragment.getFragmentManager();
    CarouselFragment carouselFragment = new CarouselFragment();
    carouselFragment.setCarouselLifecycleListener(carouselLifecycleListener);
    fm.beginTransaction().add(carouselFragment, CAROUSEL_FRAGMENT_TAG).commitAllowingStateLoss();
    return new CarouselRequestManager(this);
}
项目:GitHub    文件:RequestManagerFragment.java   
/**
 * Returns true if the fragment is a descendant of our parent.
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private boolean isDescendant(Fragment fragment) {
  Fragment root = this.getParentFragment();
  while (fragment.getParentFragment() != null) {
    if (fragment.getParentFragment() == root) {
      return true;
    }
    fragment = fragment.getParentFragment();
  }
  return false;
}
项目:Android-Client    文件:TakeQuizActivity.java   
@Override
public void onBackPressed() {
    Fragment fragment = getFragmentManager().findFragmentById(R.id.take_quiz_activity_content_layout);

    if (fragment instanceof QuestionsFragment) {
        boolean handled = ((QuestionsFragment) fragment).onBackPressed();
        if (!handled) {
            super.onBackPressed();
        }
    }
}
项目:RunMap    文件:TrackPresenterImpl.java   
@Override
public void showMapUiLayout(Context context, RelativeLayout mapUI, Fragment mapFrag) {
    if(isMapFragmentShowing){
        return;
    }
    mapFrag.setUserVisibleHint(true);
    Animation animation = AnimationUtils.loadAnimation(context, R.anim.scale_in);
    mapUI.startAnimation(animation);
    isMapFragmentShowing = true;
}
项目:ChatExchange-old    文件:HueFragmentPagerAdapter.java   
/**
 * @return may return null if the fragment has not been instantiated yet for that position - this depends on if the fragment has been viewed
 * yet OR is a sibling covered by {@link android.support.v4.view.ViewPager#setOffscreenPageLimit(int)}. Can use this to call methods on
 * the current positions fragment.
 */
public @Nullable
Fragment getFragmentForPosition(ViewPager mViewPager, int position)
{
    String tag = makeFragmentName(mViewPager.getId(), getItemId(position));
    return mFragmentManager.findFragmentByTag(tag);
}
项目:SimpleRssReader    文件:MainActivity.java   
public SavedEntriesFragment getSavedEntriesFragment() {
    if (mSavedEntriesFragment == null) {
        final Fragment fragment = getFragmentManager()
                .findFragmentByTag(SavedEntriesFragment.TAG);

        if (fragment != null) {
            mSavedEntriesFragment = (SavedEntriesFragment) fragment;
        } else {
            mSavedEntriesFragment = new SavedEntriesFragment();
        }
    }

    return mSavedEntriesFragment;
}
项目:Flora    文件:LifeAttachManager.java   
public void attach(android.support.v4.app.Fragment fragment, OnLifeListener listener) {
    if (!(Looper.myLooper() == Looper.getMainLooper())) {
        return;
    }
    try {
        LifeListenSupportFragment lFragment = getLifeListenSupportFragment(fragment);
        LifeListenerManager manager = findLifeListenerManager(lFragment);
        manager.addLifeListener(listener);
    } catch (Exception e) {
        e.printStackTrace();
    }
}