當前位置: 首頁>>代碼示例>>Java>>正文


Java Fragment.getActivity方法代碼示例

本文整理匯總了Java中android.support.v4.app.Fragment.getActivity方法的典型用法代碼示例。如果您正苦於以下問題:Java Fragment.getActivity方法的具體用法?Java Fragment.getActivity怎麽用?Java Fragment.getActivity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.app.Fragment的用法示例。


在下文中一共展示了Fragment.getActivity方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: open

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public static void open(Fragment fragment, ImageConfig config) {
    if (config == null) {
        return;
    }
    mImageConfig = config;

    if (config.getImageLoader() == null) {
        Toast.makeText(fragment.getActivity(), com.jaiky.imagespickers.R.string.open_camera_fail, Toast.LENGTH_SHORT).show();
        return;
    }

    if (!Utils.existSDCard()) {
        Toast.makeText(fragment.getActivity(), com.jaiky.imagespickers.R.string.empty_sdcard, Toast.LENGTH_SHORT).show();
        return;
    }


    Intent intent = new Intent(fragment.getActivity(), ImageSelectorActivity.class);
    fragment.startActivityForResult(intent, mImageConfig.getRequestCode());
}
 
開發者ID:Shmilyz,項目名稱:Swap,代碼行數:21,代碼來源:ImageSelector.java

示例2: dispatchMessage

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
@Override
public void dispatchMessage(Message msg) {
    Fragment fragment = fragmentRef.get();
    if (fragment == null){
        return;
    }
    if (fragment.isAdded() && (fragment.getActivity() != null)) {
        super.dispatchMessage(msg);
    } else {
        Log.d(TAG, "Fragment under destroying");
    }
}
 
開發者ID:mobilemaster128,項目名稱:quickblox-android,代碼行數:13,代碼來源:BaseToolBarFragment.java

示例3: checkActivity

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
private static Activity checkActivity(Fragment fragment) {
    Activity activity = fragment.getActivity();
    if (activity == null) {
        throw new IllegalStateException("Can't create LifecycleModelStore for detached fragment");
    }
    return activity;
}
 
開發者ID:JessYanCoding,項目名稱:LifecycleModel,代碼行數:8,代碼來源:LifecycleModelProviders.java

示例4: setHost

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
private void setHost(Object host) {
    if (host == null) {
        return;
    }
    if (host instanceof Activity) {
        mActivity = (Activity) host;
        mType = TYPE_ACTIVITY;
    } else if (host instanceof Fragment) {
        mFragment = (Fragment) host;
        mActivity = mFragment.getActivity();
        mType = TYPE_FRAGMENT;
    }
}
 
開發者ID:chendongMarch,項目名稱:uikit,代碼行數:14,代碼來源:BaseViewProxy.java

示例5: startFriendsSelection

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public static void startFriendsSelection(@NonNull Fragment fragment, int requestCode) {
    int aid = Settings.get()
            .accounts()
            .getCurrent();

    Place place = PlaceFactory.getFriendsFollowersPlace(aid, aid, FriendsTabsFragment.TAB_ALL_FRIENDS, null);

    SelectProfileCriteria criteria = new SelectProfileCriteria().setFriendsOnly(true);

    Intent intent = new Intent(fragment.getActivity(), SelectProfilesActivity.class);
    intent.setAction(SelectProfilesActivity.ACTION_OPEN_PLACE);
    intent.putExtra(Extra.PLACE, place);
    intent.putExtra(Extra.CRITERIA, criteria);
    fragment.startActivityForResult(intent, requestCode);
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:16,代碼來源:SelectProfilesActivity.java

示例6: with

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public static AgentBuilderFragment with(@NonNull Fragment fragment) {


        Activity mActivity = null;
        if ((mActivity = fragment.getActivity()) == null)
            throw new NullPointerException("activity can not be null .");
        return new AgentBuilderFragment(mActivity, fragment);
    }
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:9,代碼來源:AgentWeb.java

示例7: AuthorizationRequest

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
AuthorizationRequest(final Fragment fragment) {
    startActivityDelegate = new StartActivityDelegate() {
        @Override
        public void startActivityForResult(Intent intent, int requestCode) {
            fragment.startActivityForResult(intent, requestCode);
        }

        @Override
        public Activity getActivityContext() {
            return fragment.getActivity();
        }
    };
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:14,代碼來源:Session.java

示例8: startForResultWithZoom

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public static void startForResultWithZoom(Fragment frag, int reqCode, Class<?> fragmentClass, Bundle args) {
    if (frag == null || frag.getActivity() == null || frag.getActivity().isFinishing())
        return;

    Intent intent = new Intent(frag.getActivity(), CFCommonActivity.class);
    intent.putExtra("fragment", fragmentClass.getCanonicalName());
    intent.putExtra("args", args);
    frag.startActivityForResult(intent, reqCode);
    frag.getActivity().overridePendingTransition(R.anim.zoom_in, R.anim.zoom_none);
}
 
開發者ID:fengdongfei,項目名稱:CXJPadProject,代碼行數:11,代碼來源:CFCommonActivity.java

示例9: Builder

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
Builder(@NonNull BackFlowType type, @NonNull Fragment fragment) {
    P = new BackFlowParam(type, fragment.getActivity());
}
 
開發者ID:xuyt11,項目名稱:androidBackFlow,代碼行數:4,代碼來源:BackFlowParam.java

示例10: TContextWrap

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
private TContextWrap(Fragment fragment) {
    this.fragment = fragment;
    this.activity=fragment.getActivity();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:5,代碼來源:TContextWrap.java

示例11: Matisse

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
private Matisse(Fragment fragment) {
    this(fragment.getActivity(), fragment);
}
 
開發者ID:zhihu,項目名稱:Matisse,代碼行數:4,代碼來源:Matisse.java

示例12: DlgDatePicker

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
DlgDatePicker(Fragment f, datePickMode dpm, Date dt) {
    super(f.getActivity());
    Init(dpm, dt);
}
 
開發者ID:ericberman,項目名稱:MyFlightbookAndroid,代碼行數:5,代碼來源:DlgDatePicker.java

示例13: startMe

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public static void startMe(Fragment fragment) {
    Intent intent = new Intent(fragment.getActivity(), ListEntriesActivity.class);
    fragment.startActivity(intent);
}
 
開發者ID:zmeiko,項目名稱:LoriApp,代碼行數:5,代碼來源:ListEntriesActivity.java

示例14: IncidencePresenter

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public IncidencePresenter(Fragment fragment) {
    this.incidenceView = (IncidenceView) fragment;
    this.postIncidenceInteractor = new PostIncidenceInteractor(fragment.getActivity());
}
 
開發者ID:Mun0n,項目名稱:MADBike,代碼行數:5,代碼來源:IncidencePresenter.java

示例15: AtomViewBinding

import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public AtomViewBinding(Fragment fragment) {
    this.fragment = fragment;
    this.activity = fragment.getActivity();
}
 
開發者ID:neurospeech,項目名稱:ui-atoms-android,代碼行數:5,代碼來源:AtomViewBinding.java


注:本文中的android.support.v4.app.Fragment.getActivity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。