本文整理匯總了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());
}
示例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");
}
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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();
}
};
}
示例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);
}
示例9: Builder
import android.support.v4.app.Fragment; //導入方法依賴的package包/類
Builder(@NonNull BackFlowType type, @NonNull Fragment fragment) {
P = new BackFlowParam(type, fragment.getActivity());
}
示例10: TContextWrap
import android.support.v4.app.Fragment; //導入方法依賴的package包/類
private TContextWrap(Fragment fragment) {
this.fragment = fragment;
this.activity=fragment.getActivity();
}
示例11: Matisse
import android.support.v4.app.Fragment; //導入方法依賴的package包/類
private Matisse(Fragment fragment) {
this(fragment.getActivity(), fragment);
}
示例12: DlgDatePicker
import android.support.v4.app.Fragment; //導入方法依賴的package包/類
DlgDatePicker(Fragment f, datePickMode dpm, Date dt) {
super(f.getActivity());
Init(dpm, dt);
}
示例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);
}
示例14: IncidencePresenter
import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public IncidencePresenter(Fragment fragment) {
this.incidenceView = (IncidenceView) fragment;
this.postIncidenceInteractor = new PostIncidenceInteractor(fragment.getActivity());
}
示例15: AtomViewBinding
import android.support.v4.app.Fragment; //導入方法依賴的package包/類
public AtomViewBinding(Fragment fragment) {
this.fragment = fragment;
this.activity = fragment.getActivity();
}