Example usage for android.os Bundle getSerializable

List of usage examples for android.os Bundle getSerializable

Introduction

In this page you can find the example usage for android.os Bundle getSerializable.

Prototype

@Override
@Nullable
public Serializable getSerializable(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:de.damdi.fitness.activity.start_training.FExListFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        mWorkout = (Workout) savedInstanceState.getSerializable(ARG_WORKOUT);
        setWorkout(mWorkout);/*from  w ww  .ja  va  2s. c om*/
    }

}

From source file:de.stkl.gbgvertretungsplan.fragments.SubstitutionDetailDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Map<String, String> detailInfo = null;
    int dataType = -1;
    if (savedInstanceState != null) {
        detailInfo = (HashMap<String, String>) savedInstanceState.getSerializable("detailInfo");
        dataType = savedInstanceState.getInt("dataType", -1);
    }/*from  ww  w .  j  a va 2  s.  c o  m*/
    if (detailInfo != null)
        this.detailInfo = detailInfo;
    if (dataType != -1)
        this.dataType = dataType;

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    LayoutInflater inflater = getActivity().getLayoutInflater();

    View view = inflater.inflate(R.layout.dialog_detail, null);
    if (this.dataType == 0) {
        ((TextView) view.findViewById(R.id.className)).setText(this.detailInfo.get("className"));
        ((TextView) view.findViewById(R.id.type)).setText(this.detailInfo.get("type"));
        ((TextView) view.findViewById(R.id.lesson)).setText(this.detailInfo.get("lesson"));
        ((TextView) view.findViewById(R.id.oldRoomSubject)).setText(this.detailInfo.get("oldRoomSubject"));
        ((TextView) view.findViewById(R.id.newRoomSubject)).setText(this.detailInfo.get("newRoomSubject"));
    } else if (this.dataType == 1) {
        ((TextView) view.findViewById(R.id.className)).setText(this.detailInfo.get("teacher"));
        ((TextView) view.findViewById(R.id.type)).setText(this.detailInfo.get("type"));
        ((TextView) view.findViewById(R.id.lesson)).setText(this.detailInfo.get("lesson"));
        ((TextView) view.findViewById(R.id.oldRoomSubject))
                .setText(this.detailInfo.get("oldTeacherSubjectRoom"));
        ((TextView) view.findViewById(R.id.newRoomSubject))
                .setText(this.detailInfo.get("newTeacherSubjectRoom"));

    }
    ((TextView) view.findViewById(R.id.date)).setText(this.detailInfo.get("date"));
    if (this.detailInfo.get("substitutionInfo").trim().equals(""))
        view.findViewById(R.id.substitutionInfo).setVisibility(View.GONE);
    else {
        view.findViewById(R.id.substitutionInfo).setVisibility(View.VISIBLE);
        ((TextView) view.findViewById(R.id.substitutionInfo)).setText(this.detailInfo.get("substitutionInfo"));
    }
    builder.setView(view);

    return builder.create();
}

From source file:eu.trentorise.smartcampus.eb.fragments.CollectionsListFragment.java

@SuppressWarnings("unchecked")
@Override//w w  w .j  a v  a  2 s  .  co  m
public void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setHasOptionsMenu(true);
    if (arg0 != null && arg0.containsKey(STATE_ITEMS)) {
        collections = (List<ExpCollection>) arg0.getSerializable(STATE_ITEMS);
    } else {
        collections = new ArrayList<ExpCollection>();
        readCollections();
    }
}

From source file:com.kit.imagelib.imagelooker.ImagesLookerPhotoViewFragment.java

public boolean getExtra() {

    Bundle mBundle = getArguments();
    ImageBean imageData = (ImageBean) mBundle.getSerializable("arg");
    thumbnail_pic = imageData.thumbnail_pic;
    if (thumbnail_pic != null && thumbnail_pic.length() > 0)
        useUrl = thumbnail_pic;//from  w w  w .  ja  v  a2 s .  com

    bmiddle_pic = imageData.bmiddle_pic;
    if (bmiddle_pic != null && bmiddle_pic.length() > 0)
        useUrl = bmiddle_pic;

    original_pic = imageData.original_pic;
    if (original_pic != null && original_pic.length() > 0)
        useUrl = original_pic;

    //        LogUtils.printLog(ImagesLookerPhotoViewFragment.class, "useUrl:" + useUrl);
    return true;

}

From source file:com.basesmartframe.pickphoto.PickPhotosPreviewFragment.java

protected ArrayList<ImageBean> getPhotoListFromArg(Bundle bundle, String key) {
    ArrayList<? extends Serializable> photos = (ArrayList<? extends Serializable>) bundle.getSerializable(key);
    if (photos == null || photos.isEmpty()) {
        return new ArrayList<ImageBean>();
    }//from  w w w .  java 2  s  .com
    return (ArrayList<ImageBean>) photos;
}

From source file:com.coinomi.wallet.ui.EditAddressBookEntryFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final CoinType type = CoinID.typeFromId(args.getString(KEY_COIN_ID));
    final AbstractAddress address = (AbstractAddress) args.getSerializable(KEY_ADDRESS);
    final String suggestedAddressLabel = args.getString(KEY_SUGGESTED_ADDRESS_LABEL);

    final LayoutInflater inflater = LayoutInflater.from(context);

    final Uri uri = AddressBookProvider.contentUri(context.getPackageName(), type).buildUpon()
            .appendPath(address.toString()).build();

    final String label = AddressBookProvider.resolveLabel(context, address);

    final boolean isAdd = label == null;

    final DialogBuilder dialog = new DialogBuilder(context);

    final View view = inflater.inflate(R.layout.edit_address_book_entry_dialog, null);

    final TextView viewAddress = (TextView) view.findViewById(R.id.edit_address_book_entry_address);
    viewAddress.setText(GenericUtils.addressSplitToGroups(address));

    final TextView viewLabel = (TextView) view.findViewById(R.id.edit_address_book_entry_label);
    viewLabel.setText(label != null ? label : suggestedAddressLabel);

    dialog.setView(view);//w  ww.j  a  v  a 2 s. co  m

    final DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                final String newLabel = viewLabel.getText().toString().trim();

                if (!newLabel.isEmpty()) {
                    final ContentValues values = new ContentValues();
                    values.put(AddressBookProvider.KEY_LABEL, newLabel);

                    if (isAdd)
                        contentResolver.insert(uri, values);
                    else
                        contentResolver.update(uri, values, null, null);
                } else if (!isAdd) {
                    contentResolver.delete(uri, null, null);
                }
            } else if (which == DialogInterface.BUTTON_NEUTRAL) {
                contentResolver.delete(uri, null, null);
            }

            dismiss();
        }
    };

    dialog.setPositiveButton(R.string.button_save, onClickListener);
    if (!isAdd)
        dialog.setNeutralButton(R.string.button_delete, onClickListener);
    dialog.setNegativeButton(R.string.button_cancel, onClickListener);

    return dialog.create();
}

From source file:com.jaspersoft.android.jaspermobile.dialog.RenameDialogFragment.java

protected void initDialogParams() {
    super.initDialogParams();

    Bundle args = getArguments();
    if (args != null) {
        if (args.containsKey(SELECTED_FILE_ARG)) {
            selectedFile = (File) args.getSerializable(SELECTED_FILE_ARG);
        }//  w ww . ja  va 2 s.c  om
        if (args.containsKey(EXTENSION_ARG)) {
            extension = args.getString(EXTENSION_ARG);
        }
        if (args.containsKey(RECORD_URI_ARG)) {
            recordUri = args.getParcelable(RECORD_URI_ARG);
        }
    }
}

From source file:com.school.mailclient.app.fragment.SentFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_sent, container, false);
    sentList = (ListView) rootView.findViewById(R.id.sentList);
    swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
    swipeRefreshLayout.setOnRefreshListener(this);
    this.btnMaps = (FloatingActionButton) rootView.findViewById(R.id.btnMaps);
    this.btnMaps.setOnClickListener(this);
    btnMaps.hide();//from   w ww  . j a  v a  2s .c om
    sentList.setOnItemClickListener(this);
    sentList.setLongClickable(true);
    sentList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
    sentList.setOnItemLongClickListener(this);
    sentList.setMultiChoiceModeListener(this);

    Bundle bundle = getActivity().getIntent().getExtras();
    if (bundle != null) {
        manager = (MailManager) bundle.getSerializable("manager");
    }

    swipeRefreshLayout.post(new Runnable() {
        @Override
        public void run() {
            swipeRefreshLayout.setRefreshing(true);
            LoginValidater task = new LoginValidater();
            task.execute(new String[] { "" });
        }
    });

    return rootView;
}

From source file:com.mzs.guaji.ui.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.photo_list_image_pager);

    Bundle bundle = getIntent().getExtras();
    mPhotoList = (PhotoList) bundle.getSerializable("photolist");
    int pagerPosition = bundle.getInt("position", 0);
    isSelf = bundle.getBoolean("isSelf", true);
    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }/*from ww  w  . j  a va2s.c o m*/

    mRootLayout = (FrameLayout) findViewById(R.id.photo_list_pager_root);
    mPagerSizeText = (TextView) findViewById(R.id.pager_image_size);
    mDeletePhotoLayout = (LinearLayout) findViewById(R.id.pager_image_delete_layout);
    if (!isSelf) {
        mDeletePhotoLayout.setVisibility(View.GONE);
    }
    mDeletePhotoLayout.setOnClickListener(mDeleteClickListener);

    pager = (ViewPager) findViewById(R.id.photo_list_image_pager);
    if (mPhotoList.getPics() != null) {
        mAdapter = new ImagePagerAdapter(mPhotoList.getPics());
        pager.setAdapter(mAdapter);
        pager.setOnPageChangeListener(new OnPagerChangeListener());
        pager.setCurrentItem(pagerPosition);
    }
    mPagerSizeText.setText(pager.getCurrentItem() + 1 + "/" + mPhotoList.getPics().size());
}

From source file:com.school.mailclient.app.fragment.InboxFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_inbox, container, false);
    inboxList = (ListView) rootView.findViewById(R.id.inboxList);
    swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
    swipeRefreshLayout.setOnRefreshListener(this);
    this.btnMaps = (FloatingActionButton) rootView.findViewById(R.id.btnMaps);
    this.btnMaps.setOnClickListener(this);
    btnMaps.hide();//from   w w  w.j  a  va  2s .c  o  m
    inboxList.setOnItemClickListener(this);
    inboxList.setLongClickable(true);
    inboxList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
    inboxList.setOnItemLongClickListener(this);
    inboxList.setMultiChoiceModeListener(this);

    Bundle bundle = getActivity().getIntent().getExtras();
    if (bundle != null) {
        manager = (MailManager) bundle.getSerializable("manager");
    }

    swipeRefreshLayout.post(new Runnable() {
        @Override
        public void run() {
            swipeRefreshLayout.setRefreshing(true);
            LoginValidater task = new LoginValidater();
            task.execute(new String[] { "" });
        }
    });

    return rootView;
}