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:com.mifos.mifosxdroid.online.SurveyQuestionActivity.java

@SuppressWarnings(value = "unchecked")
@Override//from   ww  w .  j a  v a2 s.  c  o  m
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    mMapScores = (HashMap<Integer, ScorecardValues>) savedInstanceState.getSerializable(Constants.ANSWERS);
}

From source file:com.shahul3d.indiasatelliteweather.views.MapViewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_STATE)) {
        mapViewState = (ImageViewState) savedInstanceState.getSerializable(BUNDLE_STATE);
    }/*from  w ww  .  j  a  v  a  2 s .c  o  m*/
    return super.onCreateView(inflater, container, savedInstanceState);
}

From source file:com.mifos.mifosxdroid.online.SurveyQuestionViewPager.java

@SuppressWarnings(value = "unchecked")
@Override//  ww w. j av a2  s .c o  m
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    mMapScores = (HashMap<Integer, ScorecardValues>) savedInstanceState.getSerializable("answers");
}

From source file:org.mifos.androidclient.main.DepositDueDetailsActivity.java

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.deposit_due_details);

    if (bundle != null) {
        mDetails = (SavingsAccountDepositDue) bundle.getSerializable(SavingsAccountDepositDue.BUNDLE_KEY);
    }/*from   w  ww  . j  av  a2 s  .  c om*/

    mAccountNumber = getIntent().getStringExtra(AbstractAccountDetails.ACCOUNT_NUMBER_BUNDLE_KEY);
    mAccountService = new AccountService(this);
}

From source file:com.grass.caishi.cc.service.BaseIntentService.java

public void doInbackground(Message msg) {

    Bundle b = msg.getData();
    SendBean send = (SendBean) b.getSerializable("send");
    RequestParams params = new RequestParams();
    params.put("title", send.getTitle());
    params.put("text", send.getText());
    params.put("act_id", send.getAct_id());
    params.put("iss_next", send.getIss_next());
    ArrayList<String> images = send.getImg_list();
    if (images != null && images.size() > 0) {
        for (int i = 0; i < images.size(); i++) {
            File file = new File(images.get(i));
            try {
                params.put("img" + i, file, "image/jpeg");
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();/*  w  w w. j a  v a2s  .co  m*/
            }
        }
    }

    HttpRestClient.post(Constant.SEND_MATCH_DO, params, new TextHttpResponseHandler() {

        @Override
        public void onSuccess(int statusCode, Header[] headers, String responseString) {
            // TODO Auto-generated method stub
            if (CommonUtils.isNullOrEmpty(responseString)) {
                Toast.makeText(getApplicationContext(), "???", Toast.LENGTH_SHORT).show();
                return;
            }
            Map<String, Object> m = JsonToMapList.getMap(responseString);
            if (m != null && !CommonUtils.isNullOrEmpty(m.get("data")) && m.get("ok").toString().equals("1")) {
                intent.putExtra("progress", 100);
                intent.putExtra("do", UP_FINSH);
                intent.putExtra("data", m.get("data").toString());
                sendBroadcast(intent);
            }
            // filelist.remove(0);
            // if (filelist.size() == 0) {
            // intent.putExtra("progress", 100);
            // intent.putExtra("do", UP_CLEAR);
            // sendBroadcast(intent);
            // }
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
            // TODO Auto-generated method stub
            Toast.makeText(getApplicationContext(), "?", Toast.LENGTH_SHORT).show();
        }
    });
}

From source file:augsburg.se.alltagsguide.settings.PrefFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null) {
        Serializable serializable = savedInstanceState.getSerializable(PAGE_KEY);
        if (serializable != null) {
            pagesLoaded((ArrayList<Page>) serializable);
            return;
        }/*from w ww.j  a v a  2s.co  m*/
    }
    Preference clearCachePreference = findPreference("clear_cache");
    clearCachePreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            new MaterialDialog.Builder(getActivity()).title("Remove data").content(
                    "Are you sure that you want to remove the data? In order to use the app again you would require to have a network connection.")
                    .positiveText("Yes. Remove data.").negativeText("No. Go back to Preferences")
                    .onPositive(new MaterialDialog.SingleButtonCallback() {
                        @Override
                        public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                            mCacheHelper.clearData();
                            mListener.cacheCleared();
                        }
                    }).show();
            return false;
        }
    });
    refresh(LoadingType.FORCE_DATABASE);
    refresh(LoadingType.NETWORK_OR_DATABASE);
}

From source file:pl.bcichecki.rms.client.android.activities.EditDeviceActivity.java

private void setupFormFromIntent(Bundle savedInstanceState) {
    if (savedInstanceState == null) {
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            originalDevice = (Device) extras.getSerializable(EDIT_DEVICE_EXTRA);
        } else {// w  ww.j  a  va  2 s  .co  m
            originalDevice = null;
        }
    } else {
        originalDevice = (Device) savedInstanceState.getSerializable(EDIT_DEVICE_EXTRA);
    }

    deviceCopy = PojoUtils.createDefensiveCopy(originalDevice);

    if (deviceCopy == null) {
        Log.d(TAG, "No device to edit passed. Acting as new device form");
        editDeviceForm = false;
        setTitle(R.string.activity_edit_device_title_new);
    }

    if (deviceCopy != null) {
        Log.d(TAG, "Device to edit passed. Acting as edit device form");
        nameText.setText(deviceCopy.getName());
        descriptionText.setText(deviceCopy.getDescription());
    }
}

From source file:com.onegravity.contactpicker.BaseFragment.java

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

    setRetainInstance(true);//  w w w .  j a  v  a 2  s.c  o m

    if (savedInstanceState != null) {
        mQueryStrings = (String[]) savedInstanceState.getSerializable("mQueryStrings");
    }
}

From source file:de.skubware.opentraining.activity.create_exercise.SimpleDataFragment.java

/** 
 * Restore the instance state, e.g. after rotation.
 *///from w  w  w.  j  a  v a2s .c om
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_LIST_ADAPTER_DATA)) {
        mObjectList = (ArrayList<T>) savedInstanceState.getSerializable(KEY_LIST_ADAPTER_DATA);
    }
}

From source file:de.uni.stuttgart.informatik.ToureNPlaner.UI.Fragments.NodeListFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // If we get created for the first time we get our data from the intent
    Bundle data = savedInstanceState != null ? savedInstanceState : getActivity().getIntent().getExtras();
    session = (Session) data.getSerializable(Session.IDENTIFIER);

    if (savedInstanceState != null) {
        dirty = savedInstanceState.getBoolean("dirty");
    }/*from  ww  w .j a v  a2 s.c  o  m*/

    session.registerListener(NodeListFragment.class, this);

    setHasOptionsMenu(true);
}