当前位置: 首页>>代码示例>>Java>>正文


Java Bundle.getSerializable方法代码示例

本文整理汇总了Java中android.os.Bundle.getSerializable方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getSerializable方法的具体用法?Java Bundle.getSerializable怎么用?Java Bundle.getSerializable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.getSerializable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_type, container, false);
    ButterKnife.bind(this, view);

    Bundle bundle = getArguments();
    if (bundle != null){
        Pokemon pokemon = (Pokemon) bundle.getSerializable(TIPO);
        setPokemonDetail(pokemon);

    }


    return view;

}
 
开发者ID:hacktoberfest17,项目名称:programming,代码行数:19,代码来源:TypeFrangment.java

示例2: restoreSavedState

import android.os.Bundle; //导入方法依赖的package包/类
private void restoreSavedState(Bundle savedInstanceState) {
    // User rotated the screen or something
    if (BuildConfig.DEBUG) Log.v(Constants.TAG, "MainActivity: restore savedInstanceState");

    if (savedInstanceState.containsKey("me")) {
        Me = (KanboardUserInfo) savedInstanceState.getSerializable("me");
    }
    if (savedInstanceState.containsKey("dashboard")) {
        mDashboard = (KanboardDashboard) savedInstanceState.getSerializable("dashboard");
    }
    if (savedInstanceState.containsKey("projectList")) {
        mProjectList = (ArrayList<KanboardProject>) savedInstanceState.getSerializable("projectList");
        populateProjectsMenu();
    }
    if (savedInstanceState.containsKey("project"))
        mProject = (KanboardProject) savedInstanceState.getSerializable("project");
    mode = savedInstanceState.getInt("mode");
    if (savedInstanceState.containsKey("colors")) {
        Object o = savedInstanceState.getSerializable("colors");
        if (o instanceof HashMap)
            mColors = new Hashtable<>((HashMap<String, KanboardColor>) o);
        else
            mColors = (Hashtable<String, KanboardColor>) o;
    }
}
 
开发者ID:andresth,项目名称:Kandroid,代码行数:26,代码来源:MainActivity.java

示例3: onViewCreated

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onViewCreated(final View view,
                          @Nullable final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final Bundle args = getArguments();
    if (args == null) {
        throw new IllegalStateException("Missing arguments");
    }
    final Ammo ammo = (Ammo) args.getSerializable(ARG_AMMO);
    if (ammo == null) {
        throw new IllegalStateException("Missing Ammo");
    }
    setNameText(ammo.getName());
    setAmmoImageView(ammo.getImageUrl());
    if (this.weaponsRecycler != null) {
        final WeaponList weapons = PUBGApplication.getInstance().getItems().getCategories().getWeaponCategory().getWeaponsUsingAmmo(ammo.getId());
        ItemRecyclerViewAdapter<Weapon> adapter = new ItemRecyclerViewAdapter<>((weapons));
        adapter.setListener(this);
        final DividerItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
        this.weaponsRecycler.addItemDecoration(itemDecoration);
        this.weaponsRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));

        this.weaponsRecycler.setAdapter(adapter);
    }

}
 
开发者ID:ZafraniTechLLC,项目名称:Companion-For-PUBG-Android,代码行数:27,代码来源:AmmoDetailFragment.java

示例4: onAttach

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if (getArguments() != null) {
        Bundle args = getArguments();

        File file = (File) args.getSerializable(EXTRA_FILE);
        if (file == null) {
            throw new NullPointerException("file == null");
        }
        String mimeType = args.getString(EXTRA_MIME_TYPE);
        if (mimeType == null) {
            mimeType = MimeTypeUtils.getMimeType(file);
        }
        int requestCode = args.getInt(EXTRA_REQUEST_CODE);
        ArrayList<ComponentName> excluded = args.getParcelableArrayList(EXTRA_EXCLUDED);

        new ResolversPresenter(this, Injection.provideSchedulerProvider(),
                file, mimeType, requestCode, excluded,
                Injection.provideActivityInfosRepository(activity),
                Injection.provideMediaTypesRepository(activity),
                Injection.providerResolversRepository(activity));
    } else {
        throw new NullPointerException("Not found arguments");
    }
}
 
开发者ID:JulianAndroid,项目名称:AppChooser,代码行数:27,代码来源:ResolversFragment.java

示例5: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	createHandler();
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
	}
	View view = null;
	if (useCommonInterface) {
		//使用通用接口
		mBaiduNaviCommonModule = NaviModuleFactory.getNaviModuleManager().getNaviCommonModule(
				NaviModuleImpl.BNaviCommonModuleConstants.ROUTE_GUIDE_MODULE, this,
				BNaviBaseCallbackModel.BNaviBaseCallbackConstants.CALLBACK_ROUTEGUIDE_TYPE, mOnNavigationListener);
		if(mBaiduNaviCommonModule != null) {
			mBaiduNaviCommonModule.onCreate();
			view = mBaiduNaviCommonModule.getView();
		}

	} else {
		//使用传统接口
		view = BNRouteGuideManager.getInstance().onCreate(this,mOnNavigationListener);
	}


	if (view != null) {
		setContentView(view);
	}

	Intent intent = getIntent();
	if (intent != null) {
		Bundle bundle = intent.getExtras();
		if (bundle != null) {
			mBNRoutePlanNode = (BNRoutePlanNode) bundle.getSerializable(NavUtil.ROUTE_PLAN_NODE);
		}
	}
	//显示自定义图标
	if (hd != null) {
		hd.sendEmptyMessageAtTime(MSG_SHOW, 5000);
	}
}
 
开发者ID:yiwent,项目名称:Mobike,代码行数:41,代码来源:BDInnerNaviActivity.java

示例6: onCreateView

import android.os.Bundle; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    Bundle arguments = getArguments();
    PagerItem item = (PagerItem) arguments.getSerializable(KEY_ITEM);
    View view = inflater.inflate(R.layout.pager_fragment, container, false);
    TextView textView = (TextView) view.findViewById(R.id.textView);
    textView.setText(item.getTitle());
    return view;
}
 
开发者ID:StylingAndroid,项目名称:ViewPagerAnimator,代码行数:11,代码来源:PagerFragment.java

示例7: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_INITIAL_TIME)
                && savedInstanceState.containsKey(KEY_IS_24_HOUR_VIEW)) {
        mInitialTime = savedInstanceState.getParcelable(KEY_INITIAL_TIME);
        mIs24HourMode = savedInstanceState.getBoolean(KEY_IS_24_HOUR_VIEW);
        mInKbMode = savedInstanceState.getBoolean(KEY_IN_KB_MODE);
        mTitle = savedInstanceState.getString(KEY_TITLE);
        mThemeDark = savedInstanceState.getBoolean(KEY_THEME_DARK);
        mThemeDarkChanged = savedInstanceState.getBoolean(KEY_THEME_DARK_CHANGED);
        mAccentColor = savedInstanceState.getInt(KEY_ACCENT);
        mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE);
        mDismissOnPause = savedInstanceState.getBoolean(KEY_DISMISS);
        mSelectableTimes = (Timepoint[])savedInstanceState.getParcelableArray(KEY_SELECTABLE_TIMES);
        mMinTime = savedInstanceState.getParcelable(KEY_MIN_TIME);
        mMaxTime = savedInstanceState.getParcelable(KEY_MAX_TIME);
        mEnableSeconds = savedInstanceState.getBoolean(KEY_ENABLE_SECONDS);
        mEnableMinutes = savedInstanceState.getBoolean(KEY_ENABLE_MINUTES);
        mOkResid = savedInstanceState.getInt(KEY_OK_RESID);
        mOkString = savedInstanceState.getString(KEY_OK_STRING);
        mOkColor = savedInstanceState.getInt(KEY_OK_COLOR);
        mCancelResid = savedInstanceState.getInt(KEY_CANCEL_RESID);
        mCancelString = savedInstanceState.getString(KEY_CANCEL_STRING);
        mCancelColor = savedInstanceState.getInt(KEY_CANCEL_COLOR);
        mVersion = (Version) savedInstanceState.getSerializable(KEY_VERSION);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:29,代码来源:TimePickerDialog.java

示例8: handleMessage

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void handleMessage(Message msgFromService) {
   JKActivity activity = weakActivity.get();
    if (null == activity) return;
    switch (msgFromService.what) {
        case Constant.MEDIA_PLAYER_SERVICE_SONG_PLAYING://通过Bundle传递对象,显示正在播放的歌曲
            LogUtils.e(TAG, "收到消息了");
            Bundle bundle = msgFromService.getData();
            activity.mAdapter.showPlaying((MusicBean) bundle.getSerializable(Constant.MEDIA_PLAYER_SERVICE_MODEL_PLAYING));
            activity.mAdapter.notifyDataSetChanged();
            MusicBean musicBean = (MusicBean) bundle.getSerializable(Constant.MEDIA_PLAYER_SERVICE_MODEL_PLAYING);
            activity.title.setText(musicBean.getSongname());
            activity.artist.setText(musicBean.getSingername());
            Glide.with(activity).load(musicBean.getAlbumpic_big()).into(activity.playcard);
            break;
        case Constant.MEDIA_PLAYER_SERVICE_IS_PLAYING:
            LogUtils.d(TAG, "收到了来自service的信息:是否更新UI");
            if (1 == msgFromService.arg1) {//正在播放
                LogUtils.d(TAG, "play按钮触发");
                activity.mBtnPlay.setImageResource(R.mipmap.bar_puase);

            } else {
                LogUtils.d(TAG, "pause按钮触发");
                activity.mBtnPlay.setImageResource(R.mipmap.bar_play);
            }

            break;
        case Constant.MEDIA_PLAYER_SERVICE_PROGRESS:
            //    LogUtils.d("LocalMusicActivity", "进度条开始工作");
            activity.currentTime = msgFromService.arg1;
            activity.duration = msgFromService.arg2;
            if (0 == activity.duration) break;
            activity.progressBar.setProgress(activity.currentTime * 100 / activity.duration);
            break;
    }

    super.handleMessage(msgFromService);
}
 
开发者ID:popo1379,项目名称:popomusic,代码行数:39,代码来源:JKActivity.java

示例9: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * Saving instant state for every action
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_habit_events);

    Bundle extras = getIntent().getExtras();
    if (extras!=null){
        if (extras.containsKey(HabitHistoryActivity.EXTRA_EVENT_SERIAL)){
            event = (HabitEvent) extras.getSerializable(HabitHistoryActivity.EXTRA_EVENT_SERIAL);
            position = (int) extras.getSerializable(HabitHistoryActivity.EXTRA_EVENT_POSITION);
        }
    }
    if (event==null){
        finish();
        return;
    }

    mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);


    comment = (TextView) findViewById(R.id.eventComment);
    comment.setText(event.getComment());
    image = (ImageView) findViewById(R.id.eventPhoto);
    eventdate = (TextView) findViewById(R.id.eventDate);
    eventdate.setText(dateFormat.format(event.getDate()));
    toolbar = (Toolbar) findViewById(R.id.actionbar);
    toolbar.setTitle("Habit Event");
    toolbar.setNavigationIcon(R.drawable.ic_close_button);
    setSupportActionBar(toolbar);

    if (event.getEncodedPhoto()!=null){
        imageDisplay = ImageController.base64ToImage(event.getEncodedPhoto());
        image.setImageBitmap(imageDisplay);
    }else{
        imageDisplay = null;
    }

    image.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dispatchTakePictureIntent();
        }
    });
}
 
开发者ID:CMPUT301F17T09,项目名称:GoalsAndHabits,代码行数:49,代码来源:ViewEventActivity.java

示例10: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  Bundle extras = getIntent().getExtras();
  mChart = (AbstractChart) extras.getSerializable(ChartFactory.CHART);
  mView = new GraphicalView(this, mChart);
  String title = extras.getString(ChartFactory.TITLE);
  if (title == null) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
  } else if (title.length() > 0) {
    setTitle(title);
  }
  setContentView(mView);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:15,代码来源:GraphicalActivity.java

示例11: onCreateDialog

import android.os.Bundle; //导入方法依赖的package包/类
@NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        View viewContent = getActivity().getLayoutInflater().inflate(R.layout.dialog_icon, null);

        initView(viewContent);

        AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
                .setView(viewContent);

        Bundle bundle = getArguments();
        if (bundle != null) {
            iconBean = (IconBean) bundle.getSerializable("bean");
            if (iconBean != null) {
                builder.setTitle(getTitle(iconBean));
//                ivIcon.setImageResource(iconBean.getId());
                int hdIconId = getResources().getIdentifier(iconBean.getName(), "mipmap",
                        getContext().getPackageName());
                ivIcon.setImageResource(hdIconId != 0 ? hdIconId : iconBean.getId());
                viewActionSave.setVisibility(iconBean.getId() != 0 || hdIconId != 0
                        ? View.VISIBLE : View.GONE);
                viewActionSend2Home.setVisibility(iconBean.containsInstalledComponent()
                        ? View.VISIBLE : View.GONE);
            }
            if (bundle.getBoolean("pick")) {
                viewActionSave.setVisibility(View.GONE);
                viewActionSend2Home.setVisibility(View.GONE);
                viewActionChoose.setVisibility(View.VISIBLE);
            }
        }

        return builder.create();
    }
 
开发者ID:by-syk,项目名称:NanoIconPack,代码行数:34,代码来源:IconDialog.java

示例12: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle bundle = getArguments();
    if (bundle != null) {
        mTeam = (Team) bundle
                .getSerializable(TeamMainActivity.BUNDLE_KEY_TEAM);

        mTeamProject = (TeamProject) bundle
                .getSerializable(TeamMainActivity.BUNDLE_KEY_PROJECT);

        mTeamId = mTeam.getId();
    }
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:15,代码来源:TeamProjectActiveFragment.java

示例13: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	// populate list view with build items
	if (savedInstanceState == null) {			
        // set up list adapter
		
		// Okay something really funky happens here... the build object we "deserialize" from the
		// intent arguments is actually a reference to the original build in the parent activity!
		// Which causes problems because the original build's items are checked against the items
		// returned from this fragment to see if the user has made changes. In actual fact
		// any changes made will affect both build item lists meaning it will appear as though the
		// user has never changed anything!
		// The solution is to deep copy the build we get, even though it was supposedly serialized
		// which should perform the same function as deep copy...
		
		Build callerBuild = (Build) getArguments().getSerializable(IntentKeys.KEY_BUILD_OBJECT);
		//Build build = callerBuild == null ? null : (Build) UnoptimizedDeepCopy.copy(callerBuild);
		Build build = callerBuild;
		
		mFaction = build.getFaction();
		//Timber.d(this.toString(), "in EditBuildItemsFragment.onCreate(), build id = " + Integer.toHexString(System.identityHashCode(build)));
		
        mWorkingList = build.getItems() == null ? new ArrayList<BuildItem>() : build.getItems();
	} else {
		mWorkingList = (ArrayList<BuildItem>) savedInstanceState.getSerializable(KEY_BUILD_ITEM_ARRAY);
		
		// stub: doesn't keep up to date with faction selection in Info tab!
		mFaction = (Faction) savedInstanceState.getSerializable(IntentKeys.KEY_FACTION_ENUM);
	}

	// get a reference to the global DB instance
	MyApplication app = (MyApplication) getActivity().getApplicationContext();
	this.mDb = app.getDb();
}
 
开发者ID:kiwiandroiddev,项目名称:starcraft-2-build-player,代码行数:37,代码来源:EditBuildItemsFragment.java

示例14: onReceiveResult

import android.os.Bundle; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
    if (!_screenEnabled) {
        _logger.Debug("Screen is not enabled!");
        return;
    }

    _index = 0;
    _items = (List<RssItem>) resultData.getSerializable(RssService.ITEMS);
    if (_items != null) {
        _changeTextHandler.removeCallbacks(_updateRSSTextViewRunnable);
        _updateRSSTextViewRunnable.run();

        _rssTitleTextView.setText(resultData.getString(RssService.TITLE));
        _rssTitleTextView.setVisibility(View.VISIBLE);

        _rssSeparatorTextView.setVisibility(View.VISIBLE);

        _rssTextView1.setVisibility(View.VISIBLE);
        _rssTextView1Description.setVisibility(View.VISIBLE);
        _rssTextView2.setVisibility(View.VISIBLE);
        _rssTextView2Description.setVisibility(View.VISIBLE);
        _rssTextView3.setVisibility(View.VISIBLE);
        _rssTextView3Description.setVisibility(View.VISIBLE);
    } else {
        _changeTextHandler.removeCallbacks(_updateRSSTextViewRunnable);

        _rssTitleTextView.setVisibility(View.GONE);

        _rssSeparatorTextView.setVisibility(View.GONE);

        _rssTextView1.setVisibility(View.GONE);
        _rssTextView1Description.setVisibility(View.GONE);
        _rssTextView2.setVisibility(View.GONE);
        _rssTextView2Description.setVisibility(View.GONE);
        _rssTextView3.setVisibility(View.GONE);
        _rssTextView3Description.setVisibility(View.GONE);

        Toasty.error(_context, "An error appeared while downloading the rss feed.", Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-MediaServer,代码行数:43,代码来源:RSSViewController.java

示例15: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
public void onCreate(Bundle savedInstanceState)
{
	//getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
	super.onCreate(savedInstanceState);
	setContentView(R.layout.image_viewer);
	
	getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg_translucent));
	

	final long useDayCount = XPreferenceManager.getUseDayCount();
	if (useDayCount <= NOTICE_MAX || useDayCount % NOTICE_CYCLE == 0)
	{
		if (!getSupportActionBar().isShowing())
		{
			getSupportActionBar().show();
		}
	}
	
	Bundle bundle = getIntent().getExtras();
	PhotoInfoSet photoInfoSet = (PhotoInfoSet) bundle.getSerializable(GIntent.EXTRA_IMAGE_SET);
	int pagerPosition = bundle.getInt(GIntent.EXTRA_POSITION, 0);
	mExtraDirectory = bundle.getString(GIntent.EXTRA_DIRECTORY);
	String title = photoInfoSet.getAlbumname();
	getSupportActionBar().setTitle(title);
	//getToolbar().setBackgroundResource(R.drawable.actionbar_bg_translucent);
	
	mPhotoList = photoInfoSet.getData();
	
	// boolean isCacheOnDisc = true;
	if (TextUtils.isEmpty(mExtraDirectory))
	{
		// 没有缓存路径, 不进行缓存.
		mCacheOnDisc = false;
	}

	if (savedInstanceState != null)
	{
		pagerPosition = savedInstanceState.getInt(STATE_POSITION);
	}

	SaveImageOptions saveOptions = new SaveImageOptions.Builder()
		.medule("IMAGE_VIEWER")
		.extraDir(mExtraDirectory)
		.build();

	mWallpaperBaseUri = Uri.parse("file://" + new AppCacheFactory().getWallpaper());
	mCacheDir = "file://" + mImageLoader.getDiscCache().getExtraDir().toString() + "/" + mExtraDirectory;
	
	mOptions = new DisplayImageOptions.Builder()
		.showImageForEmptyUri(R.drawable.warn_image_empty)
		.showImageOnFail(R.drawable.warn_image_error)
		.resetViewBeforeLoading(true)
		.cacheOnDisc(mCacheOnDisc)
		.imageScaleType(ImageScaleType.EXACTLY)
		.bitmapConfig(Bitmap.Config.RGB_565)
		.considerExifParams(true)
		.displayer(new FadeInBitmapDisplayer(300))
		.saveImageOptions(saveOptions)
		.build();
	
	mFavoriteView = (ImageView) findViewById(R.id.favorite_tips_iv);
	mFavoriteView.setVisibility(View.GONE);
	mViewPager = (AutoScrollViewPager) findViewById(R.id.pull_refresh_viewpager);
	mViewPager.setAdapter(new ImagePagerAdapter(mPhotoList));
	mViewPager.setCurrentItem(pagerPosition);
	
	initView();
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:70,代码来源:ImageViewerActivity.java


注:本文中的android.os.Bundle.getSerializable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。